[aosd-discuss] Is return statement ignored in advice?
Roger Alexander
rtalexander at mac.com
Sun Aug 19 22:58:05 EDT 2007
On Aug 17, 2007, at 10:35 AM, Gregor Kiczales wrote:
> The return statement returns from the advice execution.
>
> In the case of before and the three afters, which run before/after
> the join
> point, this doesn't affect the execution of what would have happened.
>
> In the case of around, which is around the join point, return can
> be used to
> skip a proceed that appears in the advice body.
Is there a link to where this formally documented? For that matter,
is there any formal documentation of AspectJ? The documentation
available at www.aspectj.org is not (i.e., far from) complete, as
seemingly evidenced by this discussion.
I find it a frustration that AspectJ still lacks a complete formal
(or at least systematic) language specification. Clearly the language
continues to evolve, but unfortunately not its description. This
state of affairs needs to improve significantly if this language is
to make it to the main stream.
-----
>
>
> In my experience, confusion about this comes up when people are
> thinking
> about AspectJ advice using a 'pre-processor' or 'code injection'
> semantic
> model. If you think about the text of the before advice being
> COPIED into an
> advised method for example, you can come to think that a return in
> before
> advice would be like a return in the method itself.
>
> This is one of the many problems with thinking about AspectJ using a
> pre-processor semantics. Instead, just consider the semantics to be
> that the
> "advice EXECUTE before/after/around the join point". They aren't
> copied in,
> you can just count on them being run.
>
>
>
> On 8/17/07 9:50 AM, "Mike Mortensen" <mmo at fc.hp.com> wrote:
>
>> I'm wondering if you expected a 'return' in the advice to return
>> from the 'advised' method, but a return in the advice just exits
>> the advice and the method executes.
>>
>> If you want to change method execution, you have to create 'around
>> advice'
>> and not call proceed...
>>
>> Hopefully I correctly guessed your intention... :-)
>> -Mike
>>
>>
>>> I doubt that this is the case. If so, it's certainly a bug. I think
>>> you must be misinterpreting something. Can you give an example?
>>>
>>> Eric
>>>
>>> On 17/08/07, chuan Zhao <zhaoc at eecs.wsu.edu> wrote:
>>>
>>>
>>>> Hi All,
>>>>
>>>> I found that in AspectJ, if I put a return statement in an
>>>> advice, it will
>>>> not affect the execution of program. Is return just ignored in
>>>> any advice? I
>>>> couldn't find any explanation in AspectJ documentation. Could
>>>> anyone give
>>>> some answer to this?
>>>>
>>>> Thanks,
>>>> Chuan
>>>>
>>>> _______________________________________________
>>>> discuss mailing list - discuss at aosd.net
>>>>
>>>> To unsubscribe and change options, go to:
>>>> http://aosd.net/mailman/listinfo/discuss_aosd.net
>>>>
>>>> Check out the AOSD.net Wiki: http://aosd.net/wiki
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>>
>> _______________________________________________
>> discuss mailing list - discuss at aosd.net
>>
>> To unsubscribe and change options, go to:
>> http://aosd.net/mailman/listinfo/discuss_aosd.net
>>
>> Check out the AOSD.net Wiki: http://aosd.net/wiki
>
>
>
> _______________________________________________
> discuss mailing list - discuss at aosd.net
>
> To unsubscribe and change options, go to:
> http://aosd.net/mailman/listinfo/discuss_aosd.net
>
> Check out the AOSD.net Wiki: http://aosd.net/wiki
More information about the discuss
mailing list