#636 assignment to SETVAL causes a break if SETCHECK: ALL

closed
nobody
Lisp Core (470)
3
2012-12-04
2004-10-27
No

The user can intercept an assignment by means of
SETCHECK, SETCHECKBREAK, and SETVAL. If SETCHECK: ALL,
every assignment is intercepted and a message is
printed. If SETCHECKBREAK: TRUE, a break prompt is
given as well. The user can change the assignment in
midstream by assigning to SETVAL; that new value
replaces the original assignment.

All this works as expected, with one strangeness: the
SETVAL assignment itself is intercepted, with a message
printed and a break prompt. Exiting from this nested
break prompt takes the user back to the original break
prompt.

I guess the solution is to have the code (mset in
mlisp.lisp) pass over the assignment if the variable in
question is SETVAL.

The observed behavior is confusing, but yields the
correct result (i.e., the original assigned-to variable
is given a different assignment).

Maxima version: 5.9.1
Maxima build date: 21:24 9/23/2004
host type: i686-pc-linux-gnu
lisp-implementation-type: CMU Common Lisp
lisp-implementation-version: 19a

Discussion

  • Dieter Kaiser

    Dieter Kaiser - 2009-01-14
    • milestone: --> Includes_proposed_fix
     
  • Dieter Kaiser

    Dieter Kaiser - 2009-01-14

    This is the code with an additional check which makes sure that the code does not do an extra break when setting $setval:

    (cond ((or (null $setcheck)
    (eq $setcheck '$setcheck)))
    ((and (or (atom $setcheck)
    (memalike x (cdr $setcheck))
    (and (not (atom x))
    (memalike (caar x) (cdr $setcheck))))
    (not (eq x y)))
    (displa (list '(mtext) (disp2 x) '| set to | y))
    ;; We do not break when setting $setval itself
    (if (and $setcheckbreak (not (eq x '$setval))) ; added test
    (let (($setval y))
    (merrbreak t)
    (setq y $setval)))))

    With this additional test the strange behavior of this bug report vanish and the bug report could be closed.

    Dieter Kaiser

     
  • Dieter Kaiser

    Dieter Kaiser - 2009-01-16

    The suggested additional check has been checked out. Closing the bug report as fixed.

    Dieter Kaiser

     
  • Dieter Kaiser

    Dieter Kaiser - 2009-01-16
    • status: open --> closed
     

Log in to post a comment.