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

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


Robert Fraser wrote:
> Jason House 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.
>>>
>>>
>>> Andrei
>>
>> I agree that makes little sense.
>>
>> I'm curious, why the sudden pruning of features? Can you please 
>> consider removing SFINAE? I'd also love to see is expressions go the 
>> way of the dinosaur. I don't know what their replacement should look 
>> like, but there _has_ to be a better and less error prone syntax!
> 
> I agree about SFINAE, but what's so bad about is()? If it does get 
> removed, I hope whatever replaces it can do all the weird things is can 
> (e.x. is(typeof({}())))

If-clauses in template definitions should do everything SFINAE does, 
cleaner.

Andrei



More information about the Digitalmars-d mailing list