Smart pointers instead of GC?
Walter Bright
newshound2 at digitalmars.com
Sun Feb 2 12:05:55 PST 2014
On 2/2/2014 9:30 AM, Namespace wrote:
> Sounds good. But why @nullable instead of C# choice of "Type?" ?
Let me rephrase that as "why use a storage class rather than a type constructor?"
An excellent question.
One of the big problems with a type constructor is we've already got a number of
them - const, immutable, shared, inout. These and their conversions have taken
quite a while for people to get comfortable with, and there are still some
issues in the language arising from their interactions.
Adding another type constructor will double the number of cases. I worry that D
would collapse under the strain. This applies as well to type constructors for
"borrowed", etc.
On the other hand, D took the risky leap into the unknown by making 'ref' a
storage class rather than a type constructor (in C++ it's a type constructor).
This has turned out to be a satisfying win. I suspect it will be for @nullable,
too, though we have to work through the cases to find out for sure.
More information about the Digitalmars-d
mailing list