I want your feedback about the merit of what I want to propose.
If the feedback will be positive, I will split these into separate papers regarding every point below.
Will the committee be open to such a change?
- Bake an ownership model into the language as an opt-in mechanism using the (placeholder) keyword `unique`
- This allows us language level RAII
- This model adds zero-runtime overhead (no extra pointers are needed anywhere).
- This turns many dangling references/pointer bugs into compile errors
- Add `restrict` keyword to handle objects we don't own (it is mostly backward compatible with C)
- Make copy/move elision mandatory in more cases (guaranteed NRVO and Ultimate Copy Elision) by withhold conversion of owner objects into viewer objects.
- Make copy/move elision allowed in more cases.
- Turn `unique` into a full blown cv-qualifer which allows the following features:
- Destructive moves (move constructors taking a `unique T&&`).
- Lazy evaluation by overloading operations on `unique`
- Smart references by providing a conversion operator on a `unique` this pointer into a different type which is not `unique` (this requires several changes to overload resolution as well).
- Integrate these new keywords implicitly in certain places that need to be discussed (just like the integration of move semantics into existing C++ 03 code).
Attached a very rough draft of the functionality proposed: