Only available in Mapped Types, the
mapped keyword refers to the current instance of the type, but typed to be the original underlying type that is being mapped to.
You can think of
mapped as equivalent to
self – both refer to the same physical instance of the type, but they differ in as what type the class or record is seen.
type MyString = public class mapped to String ... var x := self; // `x` is a `MyString` var y := mapped; // `y` is a String if x = y then ... // but they are the same
'mapped' in Constructors
In mapped types, constructors can defer defer to constructors of the original type using the
mapped expression with the
constructor Call Expression. This works in symmetry with how the
inherited constructor Syntax works in "real" classes:
constructor MyObject; begin mapped constructor("Hello"); end;