How about this as a way of tidying up the definition of procdures with optional
arguments?
define foo(arg1,arg2:isboolean);
instead of just planting the code
sysPOP("arg2");
sysPOP("arg1"):
would plant the code
sysCALL("dup");
sysCALL("isboolean");
sysIFNOT(LAB);
sysPOP("arg2");
sysLABEL(LAB);
sysPOP("arg1");
The idea is that the optional arguments have a "recogniser" procedure (in this case
is boolean) which returns true if the item on the top of the stack is of the right
"type". Of course this will not work if arg1 mught be a boolean.
I will leave it upto the reader to work out the matching needed to allow the
optional arguments to have the same type :-).
Anthony.Worrall@reading.ac.uk
|