[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: around method for make-instance

I haven't really been following this discussion, but something caught
my eye:

Shannon V Spires <svspire@somnet.sandia.gov> writes:

> But if you just want to specialize make-instance (or any other method that
> takes a class as an argument) for a _single_ class, you have to use the
> (eql...) syntax because you're then defining a method on a single instance
> [of a metaclass].

Using EQL-specializers will not work if you create a subclass of the
class for which MAKE-INSTANCE has been specialized (obviously the
subclass is not eql to the superclass). This is where metaclasses can
be used. If you want to define a class (say, FOO) such that it has a
specialized MAKE-INSTANCE and all of FOO's subclasses also have this
specialized MAKE-INSTANCE, you have to define a new metaclass:




The problem is that all subclasses of FOO that are to share the new
MAKE-INSTANCE, also have to have FOO-METACLASS (or its subclass) as
their metaclass.

(This example ignores the fact that, according to AMOP, a
VALIDATE-SUPERCLASS method has to be defined for FOO-METACLASS. In MCL
this is not an issue.)

	- Ora Lassila
	  The Robotics Institute
	  Carnegie Mellon University