User Defined Attributes

David Nadlinger see at klickverbot.at
Wed Nov 14 15:56:07 PST 2012


On Wednesday, 14 November 2012 at 13:28:05 UTC, Tove wrote:
> // in this nested scope, all uints are interpreted as belonging 
> to the thrift module.
> [std.attributes(uint, thrift)]
> struct UserProfile
> ...
>
> // error detected at compile-time
> [std.attributes(uint, thrift), std.attributes(uint, thrift2)]
> struct UserProfile
> ...

»interpreted as belonging to the thrift module« – what do you 
even mean by that? As of now, UDAs are just a way to tuck 
arbitrary symbols onto declarations. There is no concept of 
»belonging« to a module, and I don't think there should be.

Also, your solution is more complex than simply using types, yet 
less flexible: What if you want to use "uint" attributes from two 
libraries on the same type?

David


More information about the Digitalmars-d-announce mailing list