Spec#, nullables and more
Simen kjaeraas
simen.kjaras at gmail.com
Sat Nov 6 02:48:04 PDT 2010
bearophile <bearophileHUGS at lycos.com> wrote:
> Simen kjaeraas:
>
>> Bounded!(int, 1, 5)[] myArr;
>> myArr ~= 1; // Compile-time error: int is not implicitly castable to
>> Bounded!(int, 1, 5)
>> myArr ~= Bounded!(int, 1, 5)( 1 ); // Works perfectly
>
> I can't say this is a nice syntax :-)
> (Isn't the implicit conversion + bound test better?)
Not sure. This way is more explicit, and errors will be caught at
compile-time.
--
Simen
More information about the Digitalmars-d
mailing list