bug in mdefmacro?



Hello Volker,

> (C1) parallel(x,y,u,v)::= buildq(
>       [ x, y:ev(y), u, v:ev(v) ],
>       block( x:y, u:v ))$
> (C2) x:1$
> (C3) y:2$
> (C4) macroexpand( parallel(x,y,y,x) );
> (D4)              BLOCK(x : y, y : x)
> (C5) parallel(x,y,y,x)$
> (C6) x;
> (D6)                  2
> (C7) y;
> (D7)                  2

With parallel defined above, I don't see anything wrong here.
Dynamic binding seems to be causing confusion here,
since the local variables x and y mask the globals of the same names.
changing the names of variables e.g. a: 1; b: 2;
parallel (a, b, b, a); does exchange the values of a and b.

As you know, gensyms or other unusual names could be used
to avoid name collisions. That works, but it is clumsy.

It can be argued that dynamic binding is suboptimal, or maybe
Maxima macros should be exactly like Lisp macros (I don't
know one way or the other), but I don't see anything here which
suggests unintended behavior (i.e., a bug).

It is not out of the question to revise the basics of the Maxima
language. If you are inspired please feel free to study the
problem and make a recommendation. There may have been
some discussion before -- you can check the mailing list archive:
http://maxima.sourceforge.net/maximalist.html

Hope this helps,
Robert