DIP6: Attributes

Leandro Lucarella llucax at gmail.com
Mon Aug 3 07:28:57 PDT 2009


Ary Borenszweig, el  3 de agosto a las 11:14 me escribiste:
> >annotation syntax in C# and Java looks like an ugly hack to me. Purely a 
> >subjective opinion, of course, but it seems really out of place in a C-family 
> >language.
> 
> Attributes has many, many other uses. Appart from serialization, you could 
> specify how a field is stored in a database. How a method maps to an http 
> request (post, get, which parameters to bind to the request, etc.). Whether a 
> method should do security checks before executing. Whether a method should be 
> run as a test, and what's the expected exception to be thrown. [insert your 
> usage here]

It's easy to support some sort of primitive-explicit AOP[1] too. It's very
used in Python. For example I've implemented the synchronized "attribute"
in Python using decorators (annotations).

[1] http://en.wikipedia.org/wiki/Aspect-oriented_programming

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
I love las minifaldas on Esmeralda
And the sexy porteños trying to pick up the Argenteenagers.
How nice, the Argenteenagers
Tomando sol in the primavera de Buenos Aires...



More information about the Digitalmars-d mailing list