Question: Optional parameter naming

I have a repetative set of parameter names used in procedures in a package. I settled on making all optional inputs in the format {name::type:=something}. Originally I wanted to use non capitalised names for the optional inputs. But the names clash with Maple commands. I have all sorts of quicky abbreviations like prnt etc. These are both messy and tacky. For many of my choices I would seem to have to use capitalised naming to give a meaningful name. The problem here is these names are used in other Maple packages. So sooner or later there is going to be a clash.

Is there a way a of handling this? Like can I defiine package parameter names? Or should I just stick with my abbreviations?

I read somewhere about this problem in the help years ago. I think Basis was the example used in different packages GroebinerBasis and Polynomial package and using PackageName:-Basis to avoid the clash with both loaded. But that is more a command level handling.

restart

 

illegal:=proc(x,y,{Point:=[symbol=solidcircle,colour=purple]},{Line:=[colour=green,thickness=2]},{Colour:="Blue"},{Scale:=5},{Print:="y"})

print("1 Point= ",Point);  #I currently use points
print("2 Line= ",Line);   #                 linetype
print("3 Colour=  ",Colour); #              clr     this has nothing to do with plotting colour
print("4 Scale= ",Scale);   #               scl   
print("5 Print= ",Print);   #               prnt
Scale*x/y
end proc

 

proc (x, y, { Colour := "Blue", Line := [colour = green, thickness = 2], Point := [symbol = solidcircle, colour = purple], Print := "y", Scale := 5 }) print("1 Point= ", Point); print("2 Line= ", Line); print("3 Colour=  ", Colour); print("4 Scale= ", Scale); print("5 Print= ", Print); Scale*x/y end proc

(1)

illegal(3,7)

"1 Point= ", [symbol = solidcircle, colour = purple]

 

"2 Line= ", [colour = green, thickness = 2]

 

"3 Colour=  ", "Blue"

 

"4 Scale= ", 5

 

"5 Print= ", "y"

 

15/7

(2)

illegal(3,7,line=[linestyle=dash,colour=black,thickness=4])

"1 Point= ", [symbol = solidcircle, colour = purple]

 

"2 Line= ", [colour = green, thickness = 2]

 

"3 Colour=  ", "Blue"

 

"4 Scale= ", 5

 

"5 Print= ", "y"

 

15/7

(3)
 

 

Download 2024-03-09_Illegal_or_Not.mw

Please Wait...