Jeffrey Kegler has asked for the wisdom of the Perl Monks concerning the following question:
the user might want to supply a callback likeSum ::= Addend + Addend
In this example, the things in angle brackets are the macros. The idea is that the parser replaces these before the callbacks are compiled.sub { <first Addend> + <second Addend> }
My question is what's the best syntax to use for macros? I want macros that are easy to use, but on the other hand don't get in the way of Perl constructs, and on the third hand (?) aren't impossible to parse out. Obviously there are tradeoffs. The angle brackets of the above example are, to my mind, not the right choice. They too easily are mistaken for other Perl syntax, both by the programmer and the parser. Note that my primary question is not how to program the macro substitution, but what syntax to use for the macros?
I'm sure other modules have tackled this same issue. Pointers to modules which monks feel did macros right would be very helpful.
thanks, jeffrey kegler
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Best Macro Syntax for Perl?
by FunkyMonk (Bishop) on Nov 12, 2007 at 00:10 UTC | |
by Jeffrey Kegler (Hermit) on Nov 12, 2007 at 01:08 UTC | |
|
Re: Best Macro Syntax for Perl?
by Joost (Canon) on Nov 11, 2007 at 23:40 UTC | |
|
Re: Best Macro Syntax for Perl?
by TGI (Parson) on Nov 12, 2007 at 17:01 UTC | |
|
Re: Best Macro Syntax for Perl?
by pemungkah (Priest) on Nov 13, 2007 at 00:34 UTC |