User Defined Attributes (UDA) in Phobos/druntime

Jacob Carlborg doob at me.com
Tue Jun 11 13:31:22 PDT 2013


On 2013-06-11 18:12, QAston wrote:

> I agree that attributes should have types - that way it's easily
> recognizable what are they for in code. "Anonymous" attributes seem to
> me to be sort of like "you can throw ANYTHING in c++" feature - it's
> there, but probably without a sane use case.
> Could you explain to me what's the benefit of the @attribute convention
> you introduce? It seems non-obvious to me.

It shows the intent of the type. D both have a keywords to indicate an 
interface and an abstract class. In C++ interfaces and abstract classes 
are possible as well, but there's no real way to tell that a given class 
is actually supposed to be used as an interface.

I was kind of disappointed with the way D implemented UDA's. Just dump 
any value/type to a symbol.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list