For this general kind of problem, I'm currently partial to using Lisp-side operators + calling Lisp functions instead of using instanceof / Java-side cast + method call. E.g., FuncallableStandardObject.java:202:
if (Symbol.SUBTYPEP.execute(arg, StandardClass.STANDARD_GENERIC_FUNCTION) != NIL) {
return new StandardGenericFunction((Layout)l);
} else {
return new FuncallableStandardObject((Layout)l);
}
(The condition was "instanceof StandardGenericFunction" until recently).
This seems more robust, and hopefully prepares us for transferring stuff Lisp-side eventually.
Rudi