🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clos
Article #557

Re: Extending syntax/semantics of method specializers

#557
From: Joe Konstan
Date: Mon, 23 Nov 1992 23:10
35 lines
2106 bytes
In article <1992Nov23.192133.10895@jpl-devvax.jpl.nasa.gov>, charest@Aig.Jpl.Nasa.Gov (Len Charest) writes:
|> Generic classes would go a long way towards extending the expressiveness of
|> DEFMETHOD. However, they would not cover all of the discrimination strategies
|> I mentioned in my original post--especially the one I find most attractive: 
|> method selection based on the *value* of a variable. To wit:
|> 
|> (defun interesting-value-p (x)
|>   (eq x *interesting-value*))
|> 
|> (defmethod observe ((thing (satisfies interesting-value-p)))
|>   ...)

Am I missing something here, or is this exactly what "eql" method specializers
are for?  Namely:

	(defmethod observer ((thing (eql *interesting-value*)))
          ...)

In fact, these can be combined nicely with macros for slot-value methods:

	(defmacro observer (object)
          `(real-observer (a-slot object) object))

        (defmethod real-observer ((sval (eql *interesting*)) (object itsclass))
         ...)

Now, I can see that extending this to an arbitrary predicate would be useful
(as has already been suggested), but I also see how easily this would
explode into a performance nightmare.  

Joe Konstan
konstan@cs.umn.edu

[for examples of using slot-value methods, and related constructs, see
 "Developing a GUIDE using object-oriented programming" in OOPSLA '91]
Technical Details
Message-ID: <1992Nov23.231003.10148@news2.cis.umn.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!saturn.cs.umn.edu!konstan
References: <1992Nov20.221251.28590@jpl-devvax.jpl.nasa.gov> <9211210425.AA12235@verdi.iisd.sra.com> <1992Nov23.113551@disun47.epfl.ch> <1992Nov23.192133.10895@jpl-devvax.jpl.nasa.gov>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!saturn.cs.umn.edu!konstan
From: konstan@saturn.cs.umn.edu (Joe Konstan)
Subject: Re: Extending syntax/semantics of method specializers
Message-ID: <1992Nov23.231003.10148@news2.cis.umn.edu>
Sender: news@news2.cis.umn.edu (Usenet News Administration)
Nntp-Posting-Host: saturn.cs.umn.edu
Organization: Department of Computer Science, University of Minnesota
References: <1992Nov20.221251.28590@jpl-devvax.jpl.nasa.gov> <9211210425.AA12235@verdi.iisd.sra.com> <1992Nov23.113551@disun47.epfl.ch> <1992Nov23.192133.10895@jpl-devvax.jpl.nasa.gov>
Date: Mon, 23 Nov 1992 23:10:03 GMT
Lines: 36