Is it really this simple?
Not quite. The restarted function will be run in the wrong dynamic environment. For example:
(declaim (optimize (debug 2)))
(defvar *a* 0)
(defun foo (a) (let ((*a* (1+ *a*))) (/ 2 a)))
(defun bar () (print *a*) (foo 0))
When you call BAR, it'll print 0 and then call FOO, which will signal an error. If we now restart BAR, the dynamic binding for *A* that
FOO
established will still be visibile, and it'll print 1 instead.
On the other hand return from frame is already supported for SBCL in SLIME.
And if I got it right the above statement also means that return from frame works the same "somewhat bad" way. I mean returning from the frame of bar (in the debugger) the value of *a* will return 1 instead of 0.
Am I right?
levy
________________________________________________________________________ Képkidolgozás már bruttó 25,- Ft-tól! FotoMarket Online Fotóáruház - már 5 éve az Ön fotószolgálatában: www.fotomarket.hu
On Fri, 20 Jan 2006 09:24:26 +0100 (CET), =?ISO-8859-2?Q?M=E9sz=E1ros_Levente?= melevy@freemail.hu said:
levy> Delivered-To: slime-devel@common-lisp.net
Is it really this simple?
Not quite. The restarted function will be run in the wrong dynamic environment. For example:
(declaim (optimize (debug 2)))
(defvar *a* 0)
(defun foo (a) (let ((*a* (1+ *a*))) (/ 2 a)))
(defun bar () (print *a*) (foo 0))
When you call BAR, it'll print 0 and then call FOO, which will signal an error. If we now restart BAR, the dynamic binding for *A* that FOO established will still be visibile, and it'll print 1 instead.
levy> On the other hand return from frame is already supported for SBCL in levy> SLIME.
levy> And if I got it right the above statement also means that return from levy> frame works the same "somewhat bad" way. I mean returning from the levy> frame of bar (in the debugger) the value of *a* will return 1 instead of levy> 0.
levy> Am I right?
Yes. However, there are two environments here:
1) The environment used to compute arguments for the command. Possibly this should be the environment of the frame, but it doesn't matter too much as long as the person debugging the code knows which environment is used.
2) The environment used to execute the command. For "restart frame", this should be the original environment of the frame, otherwise functions like FOO will fail to perform correctly. For "return from frame" it doesn't really matter which environment is used, becase no user code is executed.
__Martin