Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Re: How to specify anonymous inner class directly?

Matthew Webster wrote:
4. Refactor the code to create a named inner class.

What we are exposing here is the serendipity that Java forces us to name most things that a PCD cares about: fields, methods, classes. This is in contrast to functional languages, which are typically rife with anonymous functions, and where names are typically taken from the context rather than intrinic to the entity.

To model aspects in a functional setting, you need to attach intrinsic labels to the things you want to be able to select in the PCD. Labels are not the same as method or class names: 1) the label remains regarless of what name the thing is bound to, 2) the label is only effective for PCDs, and 3) there is no reason why several things can't have the same label, or one thing have several labels.

These ideas have come up before: attaching descriptors to methods ("this is a set method") for example.

This may be another motivating case for labels. There is no reason not to label the anonymous class. You could then capture it in a joinpoint, without refactoring the application.


Johan


Back to the top