null and type safety

Walter Bright newshound1 at digitalmars.com
Wed Nov 5 20:11:48 PST 2008


Steven Schveighoffer wrote:
> Couldn't one design a struct wrapper that implements this behavior? 

If that cannot be done in D, then D needs some design improvements. 
Essentially, any type should be "wrappable" in a struct which can alter 
the behavior of the wrapped type.

For example, you should also be able to create a ranged int that can 
only contain values from n to m:

RangedInt!(N, M) i;

Preserving this property of structs has driven many design choices in D, 
particularly with regards to how const fits into the type system.



More information about the Digitalmars-d mailing list