epsilon-devel
[Top][All Lists]
Advanced

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

Re: [epsilon-devel] Questions about Epsilon and call-stack introspection


From: Basile Starynkevitch
Subject: Re: [epsilon-devel] Questions about Epsilon and call-stack introspection.
Date: Sat, 04 Jan 2014 19:36:22 +0100

On Sat, 2014-01-04 at 18:55 +0100, Luca Saiu wrote:
> 
> 
> Do you think that destructively update a frame down the stack will be
> a common operation?  I don't see the use case.

A possible (but contrived) use case might be some aspect programming
thing.

Imagine that you have some function foo and you replace all the calls
occurrences to foo with the same call to foo preceded by a print of its
arguments and followed by a print of its result. So in Scheme notation

   (let ( (dblfoores (* 2 (foo fooarg1 fooarg2)))
        )
       ....
   )

becomes

   (let ( (_arg1 fooarg1)
          (_arg2 fooarg2)
        )
      (print "before foo arg1=" _arg1 " _arg2=" arg2)
      (let ( (_res (foo _arg1 _arg2))
           )
         (print "after foo res=" _res)
         (let ( (dblfoores (* 2 _res)))
           )
         ....
    )

of course all the names starting with _ should be fresh (e.g. _arg1
_arg2 and _res)


Now imagine foo being a complex recursive function. You are in the 3rd
call frame of foo. You apply the above "aspect" including in the two
lower frames of the old foo, so you need to alter the call frames before
your current one.

To say it another way, if you want to implement a debugger for Epsilon
in Epsilon (with breakpoints implemented in Epsilon, by Epsilon0 code
patching) you need to update frames below the current one (e.g. if you
set a breakpoint in your caller's caller).


IIRC, old Lisp machines and Smalltalk machines have been able of that
(and maybe even SBCL, whose debugger is IMHO implemented in SBCL).

Cheers

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***





reply via email to

[Prev in Thread] Current Thread [Next in Thread]