Will macros work with expressions?
Bill Baxter
dnewsgroup at billbaxter.com
Sun Sep 2 19:51:37 PDT 2007
A question about the upcoming macros:
Will they work for expressions as well as statements?
The examples in WalterAndrei.pdf all show complete statements,
like
macro foo(e) { e=3; }
But will it be possible to have:
macro foo(e) { e+3 }
I hope expressions will be allowed. Not for things like e+3 but for
making local shortcuts where aliases don't cut it:
macro call_func( arg ) {
$this.some_member.a_really_long_named_template_member(arg);
}
...
writefln(call_func(1));
writefln(call_func("hi"));
And I'm sure there'd be any number of other uses for expression macros.
--bb
More information about the Digitalmars-d
mailing list