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

Nicolas Sicard dransic at gmail.com
Sun Jan 19 01:51:41 PST 2014


On Saturday, 18 January 2014 at 22:12:09 UTC, bearophile wrote:
> Walter Bright:
>
>> I don't think a new syntax is required. We already have the 
>> template syntax:
>>
>>   RangedInt!(0,10)
>>
>> should do it.
>
> Is this array literal accepted, and can D spot the out-of-range 
> bug at compile time (Ada language allows both things)?
>
> RangedInt!(0, 10)[] arr = [1, 5, 12, 3, 2];

Even though the syntax would be less lean, D can already to this 
with templates and/or CTFE quite easily.


More information about the Digitalmars-d mailing list