Differentiate const flavors using CASE?

Chris Nicholson-Sauls ibisbasenji at gmail.com
Thu Mar 22 12:27:52 PDT 2007


Andrei Alexandrescu (See Website For Email) wrote:
> Reiner Pope wrote:
>> Andrei Alexandrescu (See Website For Email) wrote:
>>> Yah :o). Speaking of foreach_reverse, probably it would be wise to 
>>> lobby Walter to deprecate it in favor of foreach(reverse) (item ; 
>>> collection) { ... }. The keyword(extra) syntax is definitely becoming 
>>> a D signature syntax.
>>>
>>>
>>> Andrei
>> I'm surprised no-one has mentioned Tom S's proposal back from DMD 
>> 0.170: allow trailing delegates to support arbitrary iterating (see 
>> http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.announce&artnum=4940) 
>>
>>
>> It was met with a very positive reaction back then, but nothing ever 
>> really came of it.
>>
>> Basically, it allows iteration styles of any name, as people are 
>> suggesting again now, but instead of the 
>> foreach(iteration_style)(item; collection) syntax suggested here, you 
>> could just write:
>>
>>     collection.iteration_style (item) { code; }
>>
>> So you would get things like:
>>
>>     collection.random_each (i) { writefln(i); }
>>
>> Feature-wise, this doesn't add much to what people suggest here, but 
>> it makes sense when you want to go beyond foreach-style iterators. 
>> Also, some things are just better expressed without the 'foreach' 
>> there to get in the way:
>>
>>     5.times { writefln("Hello World!"); }
>>
>> Let's face it: you can do more stuff with delegates than can be 
>> described by saying 'for each element of some set.'
> 
> Walter is seriously considering this for addition; thanks for bringing 
> it up again.
> 
> 
> Andrei

One of my beloved Ruby features a candidate for D??  Okay... you guys must be putting us 
on.  This is just too much.  ;)

Any chance of an ETA for the next release?

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list