🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clos
Article #645

Re: method definition question

#645
From: lawrence.g.mayka
Date: Wed, 19 Jun 1991 00:54
29 lines
1828 bytes
In article <1991Jun17.210108.29347@Think.COM> barmar@think.com (Barry Margolin) writes:
   In article <ALANR.91Jun17130803@chopin.media-lab.media.mit.edu> alanr@chopin.media-lab.media.mit.edu (Alan Ruttenberg) writes:
   >(deftype C () '(or A B))
   >
   >(defmethod common ((instance C))
   > ...)
   >
   >This doesn't work. (can't find class C)
   >
   >My only two choices seem to be to either replicate the code, or to factor the
   >body of the definition of common into a defun which is called by both.

   If A and B have any ancestors in common you could define the method on a
   common ancestor, and then use (check-type instance 'C) to catch misuse.
   But that's also pretty inelegant.  

If A and B are standard classes, they are guaranteed to have
STANDARD-OBJECT as a common superclass; the method can be specialized
on that.  And any vendor that allows for run-time modification of the
class hierarchy should be able to optimize slot accesses in such a
method just as well as in more specialized methods.  In an ordinary
function, on the other hand, SLOT-VALUE cannot generally be optimized.


	Lawrence G. Mayka
	AT&T Bell Laboratories
	lgm@iexist.att.com

Standard disclaimer.
Technical Details
Message-ID: <LGM.91Jun18195405@cbnewsc.ATT.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!cbnewsc!cbnewsc!lgm
References: <ALANR.91Jun17130803@chopin.media-lab.media.mit.edu> <1991Jun17.210108.29347@Think.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!cbnewsc!cbnewsc!lgm
From: lgm@cbnewsc.ATT.COM (lawrence.g.mayka)
Newsgroups: comp.lang.clos
Subject: Re: method definition question
Message-ID: <LGM.91Jun18195405@cbnewsc.ATT.COM>
Date: 19 Jun 91 00:54:05 GMT
References: <ALANR.91Jun17130803@chopin.media-lab.media.mit.edu>
 <1991Jun17.210108.29347@Think.COM>
Sender: lgm@cbnewsc.att.com (lawrence.g.mayka)
Organization: AT&T Bell Laboratories
Lines: 29
In-Reply-To: barmar@think.com's message of 17 Jun 91 21: 01:08 GMT