Re: can you have interception w/o aop?

"Roger Johansson" <[email protected]>
Newsgroups gmane.comp.programming.aspect.general
Message-ID <[email protected]>
Hi, thanks for the sample.
what would it take in order to make that sample AOP?

Im just trying to find a clear definition on when something is AOP and when 
its not.

you have " (let ((fib (lambda (x)" which i guess is similair to a pointcut 
of the function "fib" ?
you have the redefined body of the function which i guess is similair to the 
advice / interceptor

what fundamental parts are that sample missing in order to be aop?

//Roger


----- Original Message ----- 
From: "Pascal Costanza" <[email protected]>
To: "Roger Johansson" <[email protected]>
Cc: <[email protected]>
Sent: Thursday, April 06, 2006 11:11 AM
Subject: Re: [aosd-discuss] can you have interception w/o aop?


>
> On 6 Apr 2006, at 09:03, Roger Johansson wrote:
>
>> Ok, I don't feel that Ive got any real clear answers to the  questions 
>> yet.
>>
>> 1) Can you have interception w/o aop?
>> Show me a pseudo code example of interception where the  interception 
>> code is
>> not modular in any way
>>
>> If your base code manually triggers some event , its not  interception , 
>> then
>> its delegation, right?
>> Atleast for me interception is when the base (source) code is  ignorant 
>> of
>> the interception mechanism.
>> and if the base source code is ignorant of that mechanism the  design is
>> modular, right?
>> thus, whenever you use interception you get AOP?
>
> Here is an example in Scheme:
>
> (define (fib x)
>   (if (< x 2)
>      1
>      (+ (fib (- x 1))
>         (fib (- x 2)))))
>
> #;> (let ((fib (lambda (x)
>                  (display "fib called")
>                  (newline)
>                  (fib x))))
>       (fib 5))
> fib called
> 8
>
> The local redefinition of fib provides what would be called a before 
> advice in AOP terms. The code embedded in the local redefinition is 
> "oblivious" in the sense that it doesn't have to change its call to  fib 
> in order to trigger the "advice".
>
> If you want to have a global effect, you have to use side effects:
>
> (let ((org-fib fib))
>       (set! fib (lambda (x)
>                   (display "fib called")
>                   (newline)
>                   (org-fib x))))
>
> #;> (fib 3)
> fib called
> fib called
> fib called
> fib called
> fib called
> 3
>
> If you're looking for a more object-oriented style, you can get 
> interception by simply using something like the Decorator pattern.  Also 
> interesting are dynamic proxies in Java, the handling of  "message not 
> understood" errors in Smalltalk or method wrappers in  Smalltalk. There 
> are probably countless other approaches.
>
>
> Pascal
>
> -- 
> Pascal Costanza, mailto:[email protected], http://p-cos.net
> Vrije Universiteit Brussel, Programming Technology Lab
> Pleinlaan 2, B-1050 Brussel, Belgium
>
>
>
> 


__________________________________________________
AOSD Discuss mailing list    -    [email protected]
To unsubscribe go to http://aosd.net

Check out the AOSD.net Wiki: http://aosd.net/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.