== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article
> 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

This one I agree with.  I wasn't even aware that the syntax above worked.  The 
use
of 4.1 to deal with the fact that the interval is exclusive is a really silly
kludge caused by this feature not being intended to be used with floating point
intervals.  It would be an argument for making the foreach interval loop more
powerful instead, except that if you're going to do that, you may as well just 
use
a regular for loop, since foreach interval loops are just a shortcut for this 
anyhow.

Reply via email to