Extended Type Design.

Bill Baxter dnewsgroup at billbaxter.com
Fri Mar 16 18:49:52 PDT 2007


Sean Kelly wrote:
> Bill Baxter wrote:
>>
>> So you mean foreach(reverse) then?  I do like that!  You're right that 
>> it is quite D-like.  Too bad you weren't around back when 
>> foreach_reverse was introduced?   ;-)
> 
> This actually came up in more general terms:
> 
> http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.announce&artnum=5015 
> 
> 
> Perhaps I over-complicated it with the talk of parallelism, but the idea 
> was still there :-)

You have it using foreach!(arg) syntax there.  But it's not really a 
template.  Maybe it could be, and if it were then that would be great 
syntax for it.  But otherwise it's just unprecendented.  A new special case.

But what Andrei points out is that there are two precedents for the 
keyword(subkeyword) syntax, where the possible subkeywords are 
pre-defined by the compiler and completely change the behavior of the 
keyword, or rather select very different behaviors all under the same 
general umbrella.  It's exactly what was needed for foreach and 
foreach_reverse.

--bb



More information about the Digitalmars-d mailing list