Question: How to pass optional arguments with repeated name

The following simple code

myproc1:=proc({parlist::list:=[]})
return parlist[1];
end proc:

myproc2:=proc(parlist::list)
return myproc1('parlist'=parlist);
end proc:

myproc2([1,2]);

fails with


Error, (in myproc1) invalid subscript selector

The reason is that myproc1 has the optional argument parlist, which has the same name as myproc2. myproc2 seems to make a name from parlist when I use the quotes which is distinct from the identifier parlist of the argument of myproc1. If I change the name of the optional argument of myproc1 everywhere the code works. But is there no way of giving the same name to the arguments of myproc1 and myproc2?

Thank You!

Please Wait...