Smart pointers instead of GC?

Walter Bright newshound2 at digitalmars.com
Sun Feb 2 11:58:58 PST 2014


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.



More information about the Digitalmars-d mailing list