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

Georg Wrede georg.wrede at iki.fi
Sun May 17 18:27:20 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.


As long as you don't also remove the regular for loop with 
floating-point types.



More information about the Digitalmars-d mailing list