[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [aosd-discuss] Dynamically scoped functions



Gregor Kiczales wrote:
>>I have pulled a fast one here. The !cflowbelow is indeed not 
>>so easy to 
>>describe with just a function that creates a list of function 
>>names. But 
>>I still think that's a good direction to investigate.
> 
> 
> And bit by bit you move towards a scheme in which there is some
> kind of predicate, that takes a description of some kinds of points
> in the execution (or code).

No, I don't think so. But I am still working on this stuff, and don't 
know yet how to describe and illustrate it...

>>Untested code which won't work. Better:
>>
>>(let ((org-main (symbol-function 'main)))
>>   (setf (symbol-function 'main)
>>	(lambda (&rest args)
>>           (dflet ...
>>             (funcall org-main ...)))))
> 
> 
> This doesn't really work either. The problem is that you may not know
> the name of the main procedure. Doing it this way weakens the non-invasiveness
> (obliviousness) property. Because I have to publish all the possible top-level
> entry points.

The code above wasn't really meant seriously. (That's why I have put 
smileys around it.)

What one needs are dynamic environments in which to run some code. The 
dflet definitions change the meaning of the functions/methods inside 
such dynamic environments.

The AspectJ approach is more or less the same in this regard, only that 
the "dynamic" environment for Java's main method is created by the 
aspect weaver in a separate compilation step (and therefore remains 
fixed at runtime). To put it differently, you circumvent the weakening 
of obliviousness by publishing only exactly one top-level entry point.

A better solution for the approach described in my paper would be an 
abstraction for implicit dynamic environments that I can use to execute 
some code in. Since something similar has already been described in 
Wolfgang de Meuter's paper about "Monads as a Theoretical Foundation for 
AOP", I haven't repeated it in my paper.


Pascal

-- 
Pascal Costanza               University of Bonn
mailto:costanza@web.de        Institute of Computer Science III
http://www.pascalcostanza.de  Römerstr. 164, D-53117 Bonn (Germany)