If we support references in #3 it can be useful to know who owns the reference. If the data instance, or something else.
This could be implemented with a dedicated keyword, owns as an example, (placeholder syntax):
def data Car {
engine: owns &Engine,
}
or alternatively with an attribute, owns_ref as an example, (placeholder syntax):
def data Car {
engine: &Engine [ owns_ref, editable ],
}
As with any new features, it can bring added complexity, and in this case I expect even further complexity when dealing with collections of references.
In the attribute based alternative we could use a new attribute, owns_item_ref, example (placeholder syntax):
def data Car {
engine: Vec<&Engine> [ owns_item_ref ],
}
With the keyword approach it would end up with (placeholder syntax):
If we support references in #3 it can be useful to know who owns the reference. If the data instance, or something else.
This could be implemented with a dedicated keyword, owns as an example, (placeholder syntax):
or alternatively with an attribute, owns_ref as an example, (placeholder syntax):
As with any new features, it can bring added complexity, and in this case I expect even further complexity when dealing with collections of references. In the attribute based alternative we could use a new attribute, owns_item_ref, example (placeholder syntax):
With the keyword approach it would end up with (placeholder syntax):