feature request: __ARGS__ for logging (cf __FILE__, __LINE__, __FUNC___)

Jacob Carlborg doob at me.com
Fri Feb 1 07:25:20 PST 2013

On 2013-02-01 15:35, bearophile wrote:

> Maybe it's the first serious proposal for D macros I see :-)
> Is it possible to re-use the <[ ]> syntax (and $...) for other purposes?

That syntax is just an abstract syntax, it does not need to look like 
that. I'm thinking we could do something similar to Scala's reify macro. 
I call this the "ast" macro. Look at the header "The AST Macro".

But to answer your question, no. It didn't cross my mind.

> Have you seen the macros of Scala language? http://scalamacros.org/

Yes, this proposal is basically the same as macros in Scala, just 
adapted the syntax for D.

> Regarding the attribute macros, my main use case for them is to extend
> the D type system in some ways. How well is such usage supported?

It might be possible, depending on what you want/need. I'm thinking you 
can do something like this:

@foo int a;

Which is replaced with:

Foo!(int) a;

It's a different type so depending on how you look at it you could say 
it affected the type system.

/Jacob Carlborg

More information about the Digitalmars-d mailing list