Le 22/03/2012 03:05, Andrei Alexandrescu a écrit :
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.


I think we have a misunderstanding here. I wasn't talking about reimplementing const or pure. I was talking about propagating them to overriden method (a way more easier task). I was talking about implementing the recently discussed behavior of override, not actually reimplementing const or pure. Not that that wouldn't be possible, but it would require a massive amount of work and a very cooperative compiler.

Inference isn't possible with an attribute system.

This is less impressive, but more realistic goal. And that is quite easy to achieve.

Have you seen what a project like lombok can do ?

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


Yes.

Reply via email to