Proposal: user defined attributes

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Mar 21 19:05:42 PDT 2012


On 3/21/12 6:02 PM, deadalnix wrote:
> Le 21/03/2012 17:22, Andrei Alexandrescu a écrit :
>> On 3/21/12 11:17 AM, Timon Gehr wrote:
>>> On 03/20/2012 10:36 PM, deadalnix wrote:
>>>> Even the propagation of pure, @safe, nothrow and const that has been
>>>> discussed recently can be done with that feature.
>>>>
>>>
>>> I'm sceptical. How would that work exactly?
>>
>> I, too, am highly skeptical. For one thing these attributes must be made
>> part of the type and have deep connections with code semantics.
>>
>> Andrei
>
> That is the point. The property must be able to manipulate what is
> qualified. This is the point of AOP.

Problem is you'd need a ton of hooks to e.g. prevent mutation in const 
methods, or do attribute inference as the compiler does now.

> If you let me some time, I could write a proposal. BTW, this is probably
> something we don't want to rush in, but I'm sure it definitively worth it.

Honest, I have zero enthusiasm for adding AOP to D right now. But I 
agree it would be an interesting project to see what it would take to 
implement something of the power of pure or const starting from zero 
knowledge.

> Have you seen what a project like lombok can do ?

This? http://projectlombok.org/ I'll take a look, thanks.


Andrei


More information about the Digitalmars-d mailing list