First class lazy Interval

Lutger lutger.blijdestijn at gmail.com
Sat Feb 28 04:21:44 PST 2009


Michel Fortin wrote:
...
> If the language can avoid the clutter in foreach and array slices, then 
> why can't we avoid it elsewhere? Why does an interval when inside a 
> language construct looks better than elsewhere? That's the oddities 
> mapping a..b to a standard type usable everywhere would avoid.

It would be more consistent and nice if a..b would work everywhere without 
problems, but imho inter(a,b) is not that much clutter. Especially when 
strides come into play, I think stride(range, x) is much more readable than 
adding even more operators. 

What would really make ranges more readable is extension methods to get rid 
of all the nesting. After two of three levels of nesting it's starts to get 
quite annoying. Reading from left to right is just more natural than from 
the inside out. 





More information about the Digitalmars-d mailing list