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

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun May 17 18:50:17 PDT 2009


Georg Wrede wrote:
> 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.

Yah.

Great, I'm glad to see that others think the same.


Andrei



More information about the Digitalmars-d mailing list