Macros: a visual aid.

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Sun Jul 8 00:52:21 PDT 2007


Chris Nicholson-Sauls wrote:

> While I'm looking forward to 2.0 macros, I've already noted one thing:
> they look an awful lot like a CTF call.  Given:
> 
> macro Foo () { ... }
> char[] Bar () { ... }
> 
> Foo();
> Bar();
> 
> Can you tell a difference?  No?  Then we're on the same page.  :)
> 
> So I had an idea: why not decorate the macro invocation in some way to
> make it stand out, such as how template instantiation uses '!()' rather
> than '()'.  I don't think re-using '!()' would be a good idea at all, so
> I pondered alternatives and arrived at something that might be familiar
> to some... the '@' sign.
> 
> macro Foo () { ... }
> char[] Bar () { ... }
> 
> @Foo();
> Bar();
> 
> Now that stands out!  So Walter, please consider some sort of decoration
> (such as the '@') for macro invocations.  I think it may save some
> future headaches, /and/ give the parser something to latch on to.


I had an impression that one should be able to (more or less) transparently
replace many builtin constructs like 'foreach' with macros eventually.



More information about the Digitalmars-d mailing list