Proposal: user defined attributes

Adam D. Ruppe destructionator at gmail.com
Fri Mar 16 11:33:37 PDT 2012


On Friday, 16 March 2012 at 18:07:18 UTC, Steven Schveighoffer 
wrote:
> Quote from TDPL (section 5.9.1 on page 156):

Huh. There's nothing I can see in the compiler that even
hints at this. The @ thing is just another storage class
as far as it's concerned right now.

> Nor do I see a huge number of library or user-defined ones 
> springing up.

Yeah.

I still really like my expression idea though, but
thinking about your strategy, we could say:

When you see @, if it is a compiler word after it,
parse it that way. Otherwise, try to get a function
call out of it.

Treat the function call as an enum and add it to the
list. Thus, it is CTFE, namespaced, etc. like normal.

The return value is appended to the declaration's
attribute expression list (so the end result is the same
as I was thinking.)


I'm pretty sure that'd work..


More information about the Digitalmars-d mailing list