[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jul 29 17:59:45 1993 
Subject:procedures with optional arguments 
From:Anthony Worrall 
Volume-ID:930729.02 

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