New blog post about Julia parametric types and constructors

I really like the tutorial.

In part 1, instead of using sizeof in

println("Generic: ", sizeof(Generic(Int8(1), Int8(2))), " bytes")
println("Parametric: ", sizeof(Parametric(Int8(1), Int8(2))), " bytes")

I recommend to use Base.summarysize and explain that the resulting 18 bytes are 16 + 2 (pointers + UInt8s). Otherwise readers might wonder how the values are stored in Generic if the pointers already take 16 bytes.

1 Like