[Maxima-commits] [git] Maxima CAS branch, master, updated. branch-5_31-base-183-gf44d669




>   > (defun funcall-or-eval (x)
>   >        (cond ((stringp x) x)
>   >              ((functionp x) (funcall x))
>   > 	     ;; other cases
>   > 	     (t (error ...))))
>   >
>   > and similarly for the suffix. I am not sure about the wisdom of such a
>   > change, but it would a relatively unobtrusive way to add more hooks...
>
>   I'm a little confused. Firstly, note that funcall-or-eval is going to
>   need some unwind protection machinery to avoid nasty infinite loops
>   (otherwise if something goes belly-up, Maxima throws and displays a new
>   prompt and the error happens again...).

Nope, I don't agree. The alt-display hooks don't try to protect the
user from himself, and I don't see why other display hooks should
either. It seems reasonable that the hook itself can do all the work
you want to assign to the caller.


>   > No, the whole prompt-notes business seems unnecessarily complicated
>   > and unneeded in src code when it can be accomplished with the existing
>   > *alt-display.d* hooks or something like that above.
>
>   My second point of confusion is, given the funcall-or-eval mechanism you
>   suggest, how can a user add something to the prompt display and be
>   reasonably sure he/she won't completely break an existing
>   *prompt-suffix* (or *prompt-prefix*). The obvious solution is to stick a
>   list of stuff to display in front of the string of an existing
>   suffix... which is what last night's patch does! 
>
>   Is there really a simpler option?

Yes, funcall-or-eval. It is simpler, at least as capable, and is similar in
spirit to the alt-display hooks.

>
>   Note that, once you've written something that prepends lists and
>   something else that adds unwind protection, you've just rewritten last
>   night's patch.

No, you've over-engineered the system. If you want to add a hook that
unwind-protects you and maintains a push-pop list of prefixes and
suffixes and so on, please do so. But I don't see the need for that in
src.

Leo