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

classes and environments

Page 3-48 of document 89-003, regarding ENSURE-CLASS, says 
  "If the class name _name_ names a class in the environment :ENVIRONMENT
  use that class."
Need to clarify that this doesn't just mean calling 
because for a remote environment you don't want to use any definition
inherited from the resident environment.  Maybe something like:

(defun ensure-class (name &rest args &key environment &allow-other-keys)
  (let ((class (find-class name nil environment)))
    (apply #'ensure-class-using-class
	   (and (not (null class))
		(not (and (environment-remote-p environment)
			  (eq class (find-class name nil nil))))
	   name args)))

However, this shadowing of class definitions raises a host of questions that
don't seem to be addressed in this document.  For example, suppose the
resident environment contains the following:

  (defclass plant () ...)
  (defclass tree (plant) ...)
  (defclass oak (tree) ...)

and then I compile a file that contains new definitions for PLANT and OAK,
with the same class inheritance but different slot options; does the
remote definition of OAK inherit from both the resident definition of TREE
and the remote definition of PLANT?  How do you keep track of the fact that
TREE has two different definitions of its superclass?  Our current
implementation handles that by having each class know the _names_ of its
direct supers and the environment in which it is defined, but 3-50 says
that the environment is not to be passed to MAKE-INSTANCE.

Similar questions arise about shadowing of generic function definitions.
When COMPILE-FILE processes a DEFMETHOD for a generic function which is
defined in the resident environment, but not yet shadowed in the remote
environment, does it use the attributes of the resident definition, or does
it create a shadowing definition in the remote environment?  I think you
probably want to use the resident definition, but that would mean that the
:ENVIRONMENT argument of ENSURE-GENERIC-FUNCTION isn't used quite the same
way as it is in ENSURE-CLASS.