Modifying user-defined attributes. UDA templates.

Yuriy yuriy.glukhov at gmail.com
Tue Mar 18 03:36:30 PDT 2014


Hello Dicebot,
I get your point. AST macros as they are explained in DIP50 are 
probably too powerful for a safe-by-default language. Also they 
could seduce users to implement custom syntax for cases, where D 
syntax could suffice. However, it's clearly seen from your 
example in vibe.d that using "decorators" expects users to know 
how to explicitly "evaluate" them. Otherwise, your "decorated" 
code could be misused if used "intuitively". Such approach 
effectively leads to at least two places in code, where you need 
to know about the logic of an attribute.

I totally agree that modifying decorators could add another way 
of shooting your foot, but it seems to me that it's benefits are 
worth it. Besides, decorating a definition with an uninstantiated 
template would not break current syntax and current UDA logic. 
Also it could be potentially implemented by lowering, as 
described in my first message. Also, don't we love C++ for it's 
infinite number of ways to shoot your foot? =)


More information about the Digitalmars-d mailing list