sequence of export variables in a module matter

September 01 2010 by mscheer 15
false
Maple 13

3


hi all,

swapping variables in the export line of a module changes its behavior.

First Example (works fine):

restart;
mp:= module() option package;
export mult, f2;
mult:=proc(v) return(3*v) end proc;
f2 :=proc(v) mult(v); end proc;
end module;

savelibname:="E:\\tmp";
savelib('mp');

restart;
libname := libname, "E:\\tmp";

with(mp);
mp:-f2(5);
mp:-mult(4);

# Output: [f2,mult], 15, 12

 

Second Example (notice: "export mult, f2;" is now "export f2, mult;")

restart;
mp:= module() option package;
export f2, mult;
mult:=proc(v) return(3*v) end proc;
f2 :=proc(v) mult(v); end proc;
end module;

savelibname:="E:\\tmp";
savelib('mp');

restart;
libname := libname, "E:\\tmp";

with(mp);
mp:-f2(5);
mp:-mult(4);

# Output: [f2,mult], mult(5), mult(4)

 

Why didn't I get [f2,mult], 15, 12?

Without the "savelib-stuff" in the second example anything is fine.

Third Example

restart;
mp:= module() option package;
export f2, mult;
mult:=proc(v) return(3*v) end proc;
f2 :=proc(v) mult(v); end proc;
end module;

mp:-f2(5);

mp:-mult(4);

# Output: [f2,mult], 15, 12

 

This seems a little weird to me. Can anyone explain this?

 

Thanks in advance!

 

 

 

 

 

 

 

 

 
Loading Comments & Answers

You must be logged into your MaplePrimes account in order to post a comment. If you don't have an account, you can create an account here.

     

Forgot Your Password? Create an Account