Attributes
Chris Nicholson-Sauls
ibisbasenji at gmail.com
Fri Dec 22 22:34:21 PST 2006
Craig Black wrote:
> C# has a feature called "attributes" that allows metadata to be extended
> with custom information. This would be very useful in D. Basic support for
> attributes in D would be possible by adding an array of objects to the
> TypeInfo class. Developers would need the ability to add attributes, and
> retrieve attributes from this array.
>
> This feature seems easy to implement and has a great deal of utility.
> Without boring anyone with details, it would make my code much more elegant
> in many ways. It would also open up some interesting new possiblities
> including fast dispatch for multimethods.
>
> -Craig
>
Actually I'm inclined to agree that it has its uses. Among the changes my Bovis projects
makes from its predecessor is adding of attributes to objects. (As symbols whose value is
presence/absence. A Bovis Object either is or is not '__Core, or '__Class, or '__Int, etc.)
One would almost need a new operator/surrogate for this purpose. And one has to decide if
attributes are a compile-time or run-time feature, whether they apply to the type, the
variable, or both... etc. Maybe here at last is a use for the poor @ character? ;)
Just thinking "aloud".
-- Chris Nicholson-Sauls
More information about the Digitalmars-d
mailing list