Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: R: Re: [aspectj-users] ITD syntax

On Mon, Dec 8, 2008 at 2:30 PM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
> I like the idea of simplifying the syntax but I keep changing my mind
> over the syntax I most prefer.  It is probably this actually:
>
>> intertype(AnotherClass){
>>
>>        public String someVar;
>>
>>        public String getSomeVar(){
>>                return someVar;
>>        }
>> }
>
> Since everything is there and it is clear.  I'm just nervous about new
> keywords and how easily I can persuade the compiler to deal with it.
> I would see this just as syntax sugar on the current ITD model though,
> and not change any semantics to say that it means anything like a
> mixin/delegation model.

How about this way to avoid a new keyword:

Options 1:
within(AnotherClass) {
        public String someVar;

        public String getSomeVar(){
                return someVar;
        }
 }

Pros: May read naturally --> "within AnotherClass, declare the following"
Cons: Will the use of within confuse developers with its usage in pointcut?

Options 2:
AnotheClass.{
        public String someVar;

        public String getSomeVar(){
                return someVar;
        }
}

Pros: Easy to explain the bulk ITD syntax compared to regular ITD
syntax-- dot and a member or dot and members.
Cons: Too subtle a use of "."?

-Ramnivas


Back to the top