AST macros

Daniel Keep daniel.keep.lists at gmail.com
Tue Mar 20 01:52:32 PDT 2007



Walter Bright wrote:
> Daniel Keep wrote:
>> Will the sort of syntax in the first example be possible?  If not, do
>> you have any thoughts on how to improve the above kind of construct
>> (either now or with D 2.0)?
> 
> I'm not understanding your example. Where is the macro?

I want "coro" to be the macro.  Basically, I want it to look like a
function, except it has a second argument list, where you can stick in
the input/output types.

You said before that you can do specialisations on syntax, so I suppose
it might be something like...

macro coro(name : name(typelist)(arglist){block}, typelist, arglist, block)
{
    // blah
}

At this stage, I'm just trying to describe the kind of syntax I'd like
to be able to make, and then you say "you can't do that, but you can do
this", and then I say "well what if we changed this little bit here",
and so forth until either one of us goes mad or we come to some sort of
middle-ground :P

Plus, I figure the more potential use-cases we show you, the better the
end result will be :)

	-- Daniel

-- 
int getRandomNumber()
{
    return 4; // chosen by fair dice roll.
              // guaranteed to be random.
}

v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/



More information about the Digitalmars-d mailing list