> Does the {.inheritable.} pragma convert an object into a pointer or keep it 
> as a normal object with copy semantics?

No. It means that the object gains a type header that allows for dynamic 
dispatch, RTTI, and such.

> Should the compiler warn that putting an Obj2 into a seq of Obj1 will drop 
> it's extra data? Or is the extra data meant to be there but there's a bug 
> somewhere?

The problem here is that copy semantics on value types with fixed size and 
actual polymorphism are incompatible; this is unavoidable. There's simply no 
place to put any extra fields, so the object is coerced to the supertype. If 
that didn't happen, methods for the subtype that accessed the missing extra 
fields would have undefined behavior.

Using pointers (whether `ref`, `ptr`, or even passing data as a `var` 
parameter) does not have that issue.

Reply via email to