type
Liquid = object of RootObj
color: int
Water = object of Liquid
sparkling: bool
var w = Water()
var l: Liquid = w # invalid object assignment [ObjectAssignmentError]
type
RefLiquid = ref Liquid
RefWater = ref Water
var rw = RefWater()
var rl: RefLiquid = rw # ok
But the manual states that:
A type a is implicitly convertible to type b iff the following algorithm returns true:
proc isImplicitlyConvertible(a, b: PType): bool =
if isSubtype(a, b):
return true
...
Am I missing something?
There's a note above that section that states:
Note: In later versions of the language the subtype relation might be changed to require the pointer indirection in order to prevent "object slicing".
So is this already the case, and the manual just needs to be updated?