On 2/2/14, 11:58 AM, Walter Bright wrote:
On 2/2/2014 8:55 AM, Andrei Alexandrescu wrote:
1. Add @nullable and provide a -nullable compiler flag to verify it. The
attribute is inferred locally and for white-box functions (lambdas,
templates),
and required as annotation otherwise. References not annotated with
@nullable
are statically enforced to never be null.
I want to clarify that @nullable would be a storage class, NOT a type
constructor. This means it will apply to the variable itself, not its type.
For example:
@nullable T* p;
auto q = p; // q is a T*, not @nullable
In a way, it would work much like ref, which is also a storage class and
not a type constructor.
That creates problems with creating arrays of nullable objects, as Timon
Gehr mentioned.
We need to think this through.
Andrei