Macros: a visual aid.

Chris Nicholson-Sauls ibisbasenji at gmail.com
Sun Jul 8 00:34:07 PDT 2007


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.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list