I suppose this is specific to C++, but can be applied to other languages as well.
With attribute containment (parameters too), there is only a global option to select between pointer and reference, in my design I would like to use a mixture of both, depending on the use of the attribute, ownership, memory management, initialisation order etc.
Currently I cant explicitly choose one or the other, I can only say by reference or by value. To get around this now I've been using * and & to specifically say which, and not specifying a containment. This works for code generation, and is clear to read, but this prevents the attribute (or parameter) updating if the type changes.
Since I set the element type to C++ I think I should be presented with 4 types of containment:
- Not Specified
- By Value
- By Reference
- By Address (or By Pointer?)
Maybe to make this more general we want to leave the 3 types:
- Not Specified
- By Value
- By Reference
and when By Reference is selected enable a secondary propery called nullable, or is nullable or something similar which can determine the type of reference across more languages than just c++. It will also allow some extra constraints to be specified in other languages.
The c++ solution is easy, can people think of a better, language independent way to represent this?