I was considering what sorts of "normally coded" things might get broken by the loading of a Maple Library package and the ensuing rebinding of names.

And so I tried this,

> with(RealDomain): # rebinds sin

> convert( cos(x), sin );
                                     sin(2 x)
                                 1/2 --------
                                      sin(x)

I was actually surprised to see that work OK. I was expecting `convert` to object to the second argument, which actually gets passed in as RealDomain:-sin.

But then I realized what was probably happening behind the scenes. The old extension mechanism for `convert` gets used. And that checks for the existence of a routine named `convert/sin`. And it seems to use concatenation to do that, such as is provided by ||.

And one reason this is amusing (to me) is that right now there's a thread going on in the usenet group comp.soft-sys.math.maple about fact that || generates global names.

Just for fun, then,

> restart:

> with(RealDomain):

> x||sin;
                                     xsin
 
> NULL||sin;
                                RealDomain:-sin
 
> foo(x,sin);
                            foo(x, RealDomain:-sin)

> `||`(x,sin);
                                     xsin

acer


Please Wait...