Extended Type Design.
Daniel Keep
daniel.keep.lists at gmail.com
Sat Mar 17 02:29:20 PDT 2007
Funny, this is beginning to read like dialogue from Sam & Max: Episode 1...
Daniel Keep wrote:
> Walter Bright wrote:
>> eao197 wrote:
>>> On Sat, 17 Mar 2007 01:41:54 +0300, Walter Bright
>>> <newshound at digitalmars.com> wrote:
>>>> D will get macros - but they won't be text processing macros, they'll
>>>> be abstract syntax tree (AST) processing macros.
Bosco: And I might have another item of interest behind the counter...
>>> It is very interesting to hear that. Could you say more about the
>>> future macro system in D? Or it is a secret now?
Sam: I accept your thinly veiled invitation to ask about the item behind
the counter.
>> It's pretty simple:
>>
>> macro foo(args)
>> {
>> ...syntax that gets inserted...
>> }
Bosco: Oh, it's a little something I like to call a Tear Gas Grenade
Launcher.
> Oh, VERY slick.
Max: "Tear Gas Grenade Launcher?" Oh, I *really* want that!
>> and the args and syntax is evaluated in the context of the invocation of
>> the macro, not the definition of the macro. You'll be able to do things
>> like:
>>
>> macro print(arg)
>> {
>> writefln(__FILE__, __LINE__, arg);
>> }
>>
>> which get the file and line in the right context. There's no way to do
>> that right now.
Bosco: It'll clear out a room full of militant college students in no
time; guaranteed!
> Wow. <3
Max: I feel really close to you right now.
:P
Question: in terms of usage, will these macros be like functions? Or
will we able to define, say, a new kind of control structure with
keywords? Or perhaps even a construct with a trailing curly brace block?
You spoil us Walter, you really do.
-- Daniel
--
Unlike Knuth, I have neither proven or tried the above; it may not even
make sense.
v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
More information about the Digitalmars-d
mailing list