foreach, an analogy

Marcio mqmnews123 at sglebs.com
Thu Oct 19 13:21:42 PDT 2006


Walter Bright wrote:
>> But couldn't the compiler easily detect this:
>>   foreach(Foo f; &fooarray.opApplyReverse) { ...
>> and and compile it as if it were a:
>>   foreach_reverse(Foo f; fooarray) { ...
> 
> Yes, it could. But it looks like a hack. A little syntactic sugar makes 
> a big difference.


	Don't these things belong to a macro layer? I mean a LISP-like macros, 
not C macros.

	In my other message I mentioned Nemerle 
http://nemerle.org/What_is_Nemerle . They talk about their macro support 
here http://nemerle.org/Macros

	I think Paul Graham has a series of essays on the advantages of macros 
in LISP etc http://www.paulgraham.com/avg.html

	Is there any text explaining what D templates can do versus macros as 
in LISP? That might be an interesting article to read...

	Thanks,

marcio



More information about the Digitalmars-d-announce mailing list