Scope, assumptions, asksign, context. Was Re: Bug in Maxima 5.30.0



I think macros are too hard for ordinary users to work with.  They
introduce (in effect) a completely new function calling semantics.  Regular
macros (as currently found in Maxima) also have a bunch of problems -- see
the Wikipedia article on hygienic
macros<https://en.wikipedia.org/wiki/Hygienic_macro>;.
Another kind of problem with macros is making sure things are evaluated the
right number of times.  Other than explicit conditional or looping
constructions, generally you'd like each argument to be evaluated exactly
once, and in the same order as in the call.

I'm not saying that these issues can't be resolved -- just that I don't
know of any system that has resolved them in such a way that typical Maxima
users (as defined by the problem reports we see..., I know, not a perfect
sample) can write macros easily and correctly.

I'm hoping we can come up with some useful primitives (which may themselves
be written as macros, as Lisp code, I don't care) which allow users to
write things like with_posval without running into the various subtle traps
we all know and love.

            -s


On Fri, Sep 6, 2013 at 1:13 PM, Robert Dodier <robert.dodier at gmail.com>wrote:

> On 2013-09-05, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
>
> > Hmm, I guess I didn't make it clear what my point was with the
> with_posval
> > example.  It is certainly possible to write with_posval in Lisp without
> > danger of variable collisions, and using supcontext and unwind-protect
> for
> > contexts.  It's probably even possible to write it in Maxima with some
> > acrobatics around variable naming. (And I don't consider writing it as a
> > macro to be a reasonable solution.)
>
> Why is a macro unreasonable? That seems rather natural, and not just to
> work around variable scope or assumption scope problems ....
>
> > However, I would claim that our current primitives make it difficult to
> > write it in Maxima in a clear, simple way.
>
> I will have a go at it. Watch this space.
>
> best
>
> Robert Dodier
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>