🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clos
Article #142

Re: PCL structure methods

#142
From: rharris
Date: Tue, 18 Aug 1992 12:08
39 lines
2033 bytes
There is a problem with discrimination on pcl::structure-object that
appears in every version of PCL newer than March 92 PCL.
In these versions of PCL, typep is sometimes used for discrimination
(when use-dispatch-dfun-p returns t).

The problem is that the class pcl::structure-object is supposed to
be a superclass of every class having metaclass structure-class, and
this requires a change to the way defstruct works.
I can think of three ways to fix this problem:

 (1) Change defstruct to :include the structure named structure-object whenever
     an :include option is not provided and the name is not structure-object
     and :type is not specified.  Move the definition of structure-object
     from pcl/defs.lisp the place that defstruct is defined.  Then change PCL
     to import the symbol structure-object from whatever package defined it.

 (2) Change typep and subtypep to simulate the effect of (1).

 (3) Change the macro class-test (pcl/methods.lisp), to be the following:

(defmacro class-test (arg class)
  (cond ((eq class *the-class-t*)
	 't)
	((eq class *the-class-slot-object*)
	 `(not (eq *the-class-built-in-class* 
		(wrapper-class (std-instance-wrapper (class-of ,arg))))))
	((eq class *the-class-standard-object*)
	 `(or (std-instance-p ,arg)
              (fsc-instance-p ,arg)
              (typep ,arg 'standard-object)))
	((or (and (structure-class-p class)
		  (not (eq class *the-class-structure-object*)))
             (eq (class-of class) *the-class-built-in-class*))
	 `(typep ,arg ',(class-name class)))
	(t
	 `(memq ',class (class-precedence-list (class-of ,arg))))))


  Richard Harris
Technical Details
Message-ID: <9208182008.AA19599@dice0>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!rdrc.rpi.edu!rharris

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!rdrc.rpi.edu!rharris
From: rharris@rdrc.rpi.edu
Subject: Re: PCL structure methods
Message-ID: <9208182008.AA19599@dice0>
Sender: daemon@cis.ohio-state.edu
Organization: The Ohio State University Department of Computer and Information Science
Date: Tue, 18 Aug 1992 12:08:07 GMT
Lines: 39