Non-null objects, the Null Object pattern, and T.init

bearophile bearophileHUGS at lycos.com
Sat Jan 18 14:43:13 PST 2014


Walter Bright:

> The point being, there is a whole universe of subset types. You 
> cannot begin to predict all the use cases, let alone come up 
> with a special syntax for each.

On the other hand there are some groups of types that are both 
very common, lead to a good percentage of bugs and troubles, and 
need a refined type semantic & management to be be handled well 
(so it's hard to implement them as library types).

So there are some solutions:
1) Pick the most common types, like pointers/class references, 
integral values, and few others, and hard code their handling 
very well in the language.
2) Try to implement some barely working versions using the 
existing language features.
3) Add enough tools to the language to allow the creation of 
"good enough" library defined features. (This is hard to do. 
Currently you can't implement "good enough" not-nullable 
reference types or ranged integers in D).
4) Give up and accept to use a simpler language, with a simpler 
compiler, that is more easy to create and develop.

Bye,
bearophile


More information about the Digitalmars-d mailing list