DIP78 - macros without syntax extensions

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Wed May 27 23:39:22 PDT 2015


On 2015-05-27 21:41, Idan Arye wrote:

> I think it's more important to be explicit in the macro invocation than
> in the macro declaration. You can tell from the macro declaration that
> it's a macro you are looking at, even without the `macro` keyword,

It depends. As far as I can see, just looking at the macro declaration 
it's just a regular function declaration. You need to look at the types.

First, you need to know that "Auto" is a special type. Second, you need 
to know that it's only a special type if the fully qualified name is 
"core.macros.Auto".

It's not enough to look at the imports in the current module, since D 
supports public imports:

module foo;

public import core.macros;

module bar;

import foo;

Auto myAssert(Auto condition, Auto message)
{
     return message;
}

Not so easy to tell that "myAssert" is a macro declaration just by 
looking in the module "bar".

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list