You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow storing abstract object references in members #82
nyan object members and sets with nyan object set types only allow non-abstract objects by default. This limitation is meant to ensure that when retrieving the object, all members are guaranteed to have values assigned. Costly checking for an uninitialized member is not necessary then.
However, it sometimes makes sense to still reference abstract objects, e.g. when the object reference is used for a type check where the member values are not needed. For this case we can use a type modifier abstract(type). For containers, this feature can be used in combination with the hierarchy_overwrite feature (see #37) to add and replace objects in an inheritance hierarchy.
# Abstract objectOtherObject():
member : float# Non-abstract childChildObject(OtherObject):
member=5.0fSomeObject():
# Default: Allows only non-abstract objectsmember_set : set(OtherObject) = {ChildObject}
# With abstract modifier: Allows both non-abstract and abstract objectsmember_set_abs : set(abstract(OtherObject)) = {OtherObject, ChildObject}
# also possible: non-container member with an abstract valuemember_abs : abstract(OtherObject) =OtherObject# This object is still abstract!StillAbstract():
member_abs : abstract(OtherObject)
NoLongerAbstract(StillAbstract):
member_abs=OtherObject
Activity