Spec#, nullables and more

so so at so.do
Sun Nov 7 07:49:30 PST 2010


Hah people bringing up the argument "bad syntax", when they got nothing to  
say!
Like they type "Matrix!(double, 5, 5)" every time they use a matrix
no you never do that, you just:
alias Matrix!(double, 5, 5) mat5; // sweet isn't it? Remember! it is a  
type!

On Sat, 06 Nov 2010 12:27:34 +0200, Simen kjaeraas  
<simen.kjaras at gmail.com> wrote:

> bearophile <bearophileHUGS at lycos.com> wrote:
>
>> Simen kjaeraas:
>>
>>> Not sure. This way is more explicit, and errors will be caught at
>>> compile-time.
>>
>> I see. But if a syntax is ugly and too much heavy, people (rightly)  
>> don't use it... (This is why bounded values are good as builtins).
>
> Of course. Now, aliases help a bit here, turning that into something
> like:
>
> alias Bounded!(int, 1, 5) myInt;
>
> myInt[] myArr;
> myArr ~= myInt( 1 );
>
>
> I believe using an alias would be a good idea in most such cases, as
> one's bound to write Bounded!(int,1,6) in a long program, and
> wonder why it doesn't compile.
>


-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d mailing list