[aspectc-user] reset tjp->that()?
Michael Gong
mwgong at cs.utoronto.ca
Mon Dec 11 13:19:05 CET 2006
Good to know.
----- Original Message -----
From: "Daniel Lohmann" <daniel.lohmann at informatik.uni-erlangen.de>
To: <aspectc-user at aspectc.org>
Sent: Monday, December 11, 2006 3:23 AM
Subject: Re: [aspectc-user] reset tjp->that()?
> Michael Gong schrieb:
>> Hi, Daniel & Yan,
>>
>> It brings an interesting question.
>>
>> The template works fine for this case.
>>
>>> I am afraid what you are trying to achieve is not possible.
>>> // Template, works for any class that offers a Release() method
>>> template< class T > void Release( T*& _this ) {
>>> _this->Release(); // destroy
>>> _this = 0; // invalidate
>>> }
>>>
>>
>> But how about I want to do the "invalidation" for method "Release2" ,
>> "Release3", or etc ? Using template, you might have :
>>
>> template< class T > void Release2( T*& _this ) {
>> _this->Release2(); // destroy
>> _this = 0; // invalidate
>> }
>>
>> template< class T > void Release3( T*& _this ) {
>> _this->Release3(); // destroy
>> _this = 0; // invalidate
>> }
>>
>> ...
>>
>> It is typical crosscutting concern, I think.
>
> You mean the pointer invalidation? I guess one could say so.
>
>> Since AOP is targeted to modularize crosscutting concern, can it be
>> used
>> for this case ? More specifically, can AspectC++ capture it ?
>
> The AspectC++ *language* is able to express this:
>
> aspect Invalidator {
> advice execution("void Release%<...>(%)") : after() {
> *tjp->arg<0>() = 0;
> }
> };
>
> The ac++ *weaver*, however, is currently not able to weave this, as
> support for weaving in template code is yet to come.
>
> Daniel
>
>
>
> _______________________________________________
> aspectc-user mailing list
> aspectc-user at aspectc.org
> http://www.aspectc.org/mailman/listinfo/aspectc-user
>
More information about the aspectc-user
mailing list