type
Fruit = object of RootObj
name*: string
Apple = object of Fruit
color: int
Pear = object of Fruit
origin: string
echo [Apple(name:"a"), Pear(name:"b")]
Looking at the generated code, I see that under the hood, (1) calls genericAssign which does a type check to prevent assignment of child type to parent type. But for (2) it doesn't call that, so the assignment succeeds with slicing as one would see in c++.
Which behavior is the "official"/"correct" one? Coming from c++, (2) feels more "natural", but it would be nice if the compiler also gives you a warning about assigning child to parent type and lets you proceed to potentially shoot off your foot.