Proposal: user defined attributes

F i L witte2008 at gmail.com
Sun Mar 18 05:39:18 PDT 2012


Tove wrote:
> 1. x! would parse all decls at compile time...
> 2. all attributes that need to modify the constructor is 
> inserted at the points where the x! enabled constructors are 
> declared/implemented...
>
> x!("@GC.NoScan @GC.Hot @attribute(Serializable.yes) int 
> value;");
>
> x!(q{this()
> {
>   /* everything from 'x' is auto inserted here */
>   my;
>   normal;
>   constructor;
>   tokens;
> });

I see, that would work. But why not just build this same 
operation into the compiler so the definition syntax is the same 
as usual. The mixin's are powerful but a bit ugly. Not to mention 
not IDE parser on the planet is going to be able to figure out 
all that to give you intelligent code-completion.



More information about the Digitalmars-d mailing list