Commit 64e9d49b authored by rschlatte@1c010e3e-69d0-11dd-93a8-456734b0d56f's avatar rschlatte@1c010e3e-69d0-11dd-93a8-456734b0d56f
Browse files

Remove casts to StandardGenericFunction

Replaced with function invocations / slot access.

Also remove some outdated comments.
parent 6fb863fc
......@@ -2657,10 +2657,10 @@ public final class Primitives {
value1 = NIL;
value2 = T;
value3 = ((Function)arg).getLambdaName();
} else if (arg instanceof StandardGenericFunction) {
} else if (arg.typep(StandardClass.GENERIC_FUNCTION) != NIL) {
value1 = NIL;
value2 = T;
value3 = ((StandardGenericFunction)arg).getInstanceSlotValue(Symbol.NAME);
value3 = Symbol.GENERIC_FUNCTION_NAME.execute(arg);
} else if (arg instanceof FuncallableStandardObject) {
return this.execute(((FuncallableStandardObject)arg).function);
} else {
......@@ -4220,8 +4220,8 @@ public final class Primitives {
if (arg instanceof Operator) {
return ((Operator)arg).getLambdaName();
}
if (arg instanceof StandardGenericFunction) {
return ((StandardGenericFunction)arg).getInstanceSlotValue(Symbol.NAME);
if (arg.typep(StandardClass.GENERIC_FUNCTION) != NIL) {
return Symbol.GENERIC_FUNCTION_NAME.execute(arg);
}
if (arg instanceof FuncallableStandardObject) {
return this.execute(((FuncallableStandardObject)arg).function);
......@@ -4245,8 +4245,11 @@ public final class Primitives {
((Operator)first).setLambdaName(second);
return second;
}
if (first instanceof StandardGenericFunction) {
((StandardGenericFunction)first).setInstanceSlotValue(Symbol.NAME, second);
// KLUDGE: this isn't fully general, but lots of other stuff
// will break for generic functions that aren't subclasses
// of standard-generic-function as well.
if (first.typep(StandardClass.STANDARD_GENERIC_FUNCTION) != NIL) {
((StandardObject)first).setInstanceSlotValue(Symbol.NAME, second);
return second;
}
if (first instanceof FuncallableStandardObject) {
......
......@@ -3005,6 +3005,8 @@ public class Symbol extends LispObject implements java.io.Serializable
PACKAGE_MOP.addExternalSymbol("FUNCALLABLE-STANDARD-CLASS");
public static final Symbol GENERIC_FUNCTION_METHODS =
PACKAGE_MOP.addExternalSymbol("GENERIC-FUNCTION-METHODS");
public static final Symbol GENERIC_FUNCTION_NAME =
PACKAGE_MOP.addExternalSymbol("GENERIC-FUNCTION-NAME");
public static final Symbol METAOBJECT =
PACKAGE_MOP.addExternalSymbol("METAOBJECT");
public static final Symbol METHOD_FUNCTION =
......
;;;; Does not currently include all the MOP, but it should.
(in-package #:mop)
;;; StandardGenericFunction.java defines FUNCALLABLE-INSTANCE-FUNCTION and
;;; SET-FUNCALLABLE-INSTANCE-FUNCTION.
;;;
;;; TODO
;;;
;;; 1. Verify that we can make FUNCALLABLE-STANDARD-CLASS instances
;;; which work.
;;;
;;; 2. Tighten the type checks so that only instances of
;;; FUNCALLABLE-STANDARD-CLASS are callable.
(in-package #:mop)
;;; AMOP pg. 240ff.
(defgeneric validate-superclass (class superclass)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment