foreach (x; a .. b) and foreach_reverse (x; a .. b) should be disallowed for floats

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Mon May 18 03:09:36 PDT 2009


Andrei Alexandrescu wrote:
> Consider:
> 
>     foreach (x; 1.0 .. 4.1) writeln(x);
>     foreach_reverse (x; 1.0 .. 4.1) writeln(x);
> 
> This sucks. foreach with interval for floating-point types should be 
> disallowed.
> 
> 
> Andrei

I didn't even know this was possible, but I agree, it's an ugly thing.

-Lars



More information about the Digitalmars-d mailing list