🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clos
Article #427

RE: accessing clos objects

#427
From: Skip Egdorf
Date: Thu, 14 Feb 1991 20:51
51 lines
2461 bytes
Oh yes, another thing about the Symbolics Bug/feature with :metaclass

;;; Sun Common Lisp, Development Environment 4.0.1, 6 July 1990
;;; Sun-4 Version for SunOS 4.0.x and sunOS 4.1
;;;
;;; Copyright (c) 1985, 1986, 1987, 1988, 1989, 1990
;;;            by Sun Microsystems, Inc.,  All Rights Reserved
;;; Copyright (c) 1985, 1986, 1987, 1988, 1989, 1990
;;;            by Lucid, Inc., All Rights Reserved
;;; This software product contains confidential and trade secret
;;; information belonging to Sun Microsystems, Inc.  It may not be copied
;;; for any reason other than for archival and backup purposes.
;;;
;;; Sun, Sun-4, and Sun Common Lisp are trademarks of Sun Microsystems Inc.

;;; Loading source file "/home/zaphod/egdorf/lisp-init.lisp"
> (defclass CLASS-WITH-INSTANCES (standard-class)
  ((instances
    :initform nil
    :accessor class-instances)))
#<Standard-Class CLASS-WITH-INSTANCES>
> (defmethod MAKE-INSTANCE :around ((class CLASS-WITH-INSTANCES) &rest ignore)
	   (let ((instance (call-next-method)))
	     (push instance (class-instances class))
	     instance))
#<Init-Method MAKE-INSTANCE :AROUND (CLASS-WITH-INSTANCES)>
> (defclass class-with-instances-test ()
  ()
  (:metaclass CLASS-WITH-INSTANCES))
#<Class-With-Instances CLASS-WITH-INSTANCES-TEST>
> (defun foo ()
  (make-instance 'class-with-instances-test))
FOO
> (make-instance 'class-with-instances-test)
#<Class-With-Instances-Test #X166748E>
> (class-instances (find-class 'class-with-instances-test))
(#<Class-With-Instances-Test #X166748E>)
> (foo)
#<Class-With-Instances-Test #X1671AC6>
> (class-instances (find-class 'class-with-instances-test))
(#<Class-With-Instances-Test #X1671AC6> #<Class-With-Instances-Test #X166748E>)
>

Works for me...
And running it all from gnu emacs with some local additions to cmulisp mode,
I could just cut and paste to this message.
I don't miss zmacs at all.

					Skip Egdorf
					hwe@lanl.gov
Technical Details
Message-ID: <9102142051.AA04920@zaphod.lanl.gov.lanl.gov>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!decwrl!uunet!tut.cis.ohio-state.edu!ZAPHOD.LANL.GOV!egdorf
References: <9102141835.AA19768@cheops.cis.ohio-state.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!decwrl!uunet!tut.cis.ohio-state.edu!ZAPHOD.LANL.GOV!egdorf
From: egdorf@ZAPHOD.LANL.GOV (Skip Egdorf)
Newsgroups: comp.lang.clos
Subject: RE: accessing clos objects
Message-ID: <9102142051.AA04920@zaphod.lanl.gov.lanl.gov>
Date: 14 Feb 91 20:51:55 GMT
References: <9102141835.AA19768@cheops.cis.ohio-state.edu>
Sender: welch@tut.cis.ohio-state.edu
Distribution: inet
Organization: CommonLoops
Lines: 51