unwind protect



Hi Barton,

> (defmspec $unwind_protect (e)
>   (setq e (margs e))
>   (unwind-protect (meval (first e)) (mapcar #'meval (rest e))))

Hmm, that sounds like a good idea. Some random comments.

(1) I wonder how Lisp unwind-protect interacts with Maxima throw/catch
and error/errcatch.

(2) Does it make any difference if a non-local return comes from
a Lisp function vs a Maxima function?

(3) unwind-protect treats its first argument very differently from its 2nd.
Can we use a bit of syntax to distinguish the arguments? By this I
mean, let's put a keyword in between the two kinds of arguments, e.g.:

  protect (foo(x), bar(y)) with baz(z);

or

  attempt (a, b, c) and_always_do (c, d, e);

or something like that. Maxima already has various constructs which
make different kinds of arguments more easily distinguishable by
syntax, e.g. if -- then -- else, for -- do.


All the best,
Robert