www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Attributes

reply "Craig Black" <cblack ara.com> writes:

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
Dec 22 2006
parent reply Chris Nicholson-Sauls <ibisbasenji gmail.com> writes:
Craig Black wrote:

 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
Dec 22 2006
parent Daniel Keep <daniel.keep+lists gmail.com> writes:
Chris Nicholson-Sauls wrote:
 Craig Black wrote:
 

 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
' ' already has a use... CWEB (and by extension, DWEB) uses it. :P -- Daniel
Dec 23 2006