Macro syntax limitations?
Johan Granberg
lijat.meREM at OVE.gmail.com
Mon Mar 19 16:24:33 PDT 2007
Broken out from another thread
Walter Bright wrote:
> There's a way to do this using specialization:
>
> macro foo(somevec : somevec+=othervec+somevec, othervec)
>
> which will only match for parameters of the form:
>
> foo( a += b + a);
>
Seeing this syntax i think it is fair to that macros can be made to look
like function calls but will we be able to emulate other constructs to?
and what are the limitations?
some examples that might be nice to be able to do
unless(condition)
statement;
statement that could be a block or a single line like in if
and
StaticClass Foo
{
void bar(){}
}
that would be a macro that creates a completely static class by marking a
fields and methods static.
Don't focus to muck on the usefullness of the examples but more if it will
be possible with D's macros.
ps. The macros look real promissing keep up the good work :)
More information about the Digitalmars-d
mailing list