generic + numeric + literals = abomination

so so at
Sat Mar 27 05:47:03 PDT 2010

On Sat, 27 Mar 2010 13:52:28 +0200, bearophile <bearophileHUGS at>  

> Can you explain better what the problem is and what kind of solution you  
> would like?
> Bye,
> bearophile

One thing i can think of now is adding another float literal, maybe 'r',  
for "real"!,
Which means you are free to cast this to any floating point suitable.
Some kind of template, i don't know!

So when i have something like this :

scalar m = 0.99999999999999999999999999r;

when scalar is f32 :
scalar m = 0.99999999999999999999999999f;
when scalar is f64 :
scalar m = 0.99999999999999999999999999;

And it is easy to detect for the compiler i guess.

scalar m = 0.2r; // just cast it to scalar, user wants to assign to a  
scalar n = m * 4.5r; // again just cast it to scalar, user wants to  
multiply by a scalar.

Thanks :)

Using Opera's revolutionary e-mail client:

More information about the Digitalmars-d-learn mailing list