Proposal: user defined attributes

RivenTheMage riven-mage at id.ru
Mon Mar 19 08:52:30 PDT 2012


On Monday, 19 March 2012 at 00:41:44 UTC, Walter Bright wrote:

> Maybe this is why I don't much care for attributes - it's all 
> just a fog to me what is happening.

Maybe this will help:

http://research.microsoft.com/en-us/um/people/cszypers/events/WCOP2006/rouvoy-wcop-06.pdf

Attribute-Oriented Programming (@OP) is a program-level marking
technique. Basically, this approach allows developers to mark
program elements (e.g., classes, methods, and fields) with
annotations to indicate that they maintain application specific
or domain-specific concerns. For example, a developer may define
a logging annotation and associate it with a method to indicate
that the calls to this method should be logged, or may define a
web service annotation and associate it with a class to indicate
that the class should implement a Web Service. Annotations
separate application’s business logic from middleware-specific
or domain-specific concerns (e.g., logging and web service
functions). By hiding the implementation details of those
semantics from program code, annotations increase the level of
programming abstraction and reduce programming complexity,
resulting in simpler and more readable programs. The program
elements associated with annotations are transformed to more
detailed program code by a supporting generation engine. For
example, a generation
engine may insert logging code into the methods associated with a
logging annotation. Dependencies on the underlying middleware are
thus replaced by annotations, acting as weak references — i.e.,
references that are not mandatory for the application. This means
that the evolution of the underlying middleware is taken into
account by the generation engine and let the program code
unchanged.


More information about the Digitalmars-d mailing list