Anthony Worrall (adw@csug.cs.reading.ac.uk) wrote:
> How about this as a way of tidying up the definition of procdures with
> optional arguments?
>
> define foo(arg1,arg2:isboolean);
The next version of ObjectClass will allow you to define methods that take
optional arguments in just this way. (In fact, early versions of
ObjectClass did too -- but I was finally convinced that without some
kind of accident-prevention syntax it got you into more trouble than
was proper.)
It even uses the syntax you suggest! However, at the moment the only
"predicates" you are allowed to use to select arguments are recognisers.
I am working on a version that will allow arbitrary procedures but
there are some nasty interactions with multiple inheritance and
multi-methods. (Pity).
> 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 :-).
In fact, ObjectClass is about as efficient but rather more general. It
is able to cope with all the matching requirements. The only thing it
doesn't do is allow you arbitrary procedures. Future versions that will
allow arbitrary procedures will require some assistance in sorting out
the matching problem. But that won't be *too* hard, I think.
Oh yes -- you can pick up the current version of ObjectClass from
Julian Clinton at ISL (julianc@integ.co.uk). And for anyone who has
read this far & is still in the dark, ObjectClass is a CLOS-like
object-oriented extension to Pop11.
Steve
|