🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clos
Article #467

Re: Beefs (moooo!) about lambda list congruency

#467
From: John R. Bane
Date: Wed, 20 Mar 1991 01:54
37 lines
2261 bytes
In article <9103181745.AA18191@mingus.mitre.org> john@LINUS.MITRE.ORG writes:
>
>I don't think it makes sense to specialize on &OPTIONAL parameters.
>For instance, think about:
>
>  (DEFMETHOD PRINT-SOMETHING ((X MY-THING) &OPTIONAL (STREAM SPECIAL-STREAM))
>    (PRINT-MY-THING-INTERNAL X STREAM))
>
>Here, (STREAM SPECIAL-STREAM) is meant to indicate the specialization
>of the optional argument STREAM, not its default value.  Let's not
>even bother discussing the necessary (but horrible!) additions to the
>syntax that would distinguish between specializations and default
>values.

I think that specializing on &OPTIONAL parameters makes perfect sense, but
mainly in the syntactically godawful case you mention, when the &OPTIONAL
parameters have default values specified.  If there is a specified default,
then as far as the generic function is concerned, the parameter is always
specified, and should be no different from a required parameter for
method lookup.  To really make it make sense, the requirement should be
that all &OPTIONAL parameters have a default expression, and that congruent
parameters have the SAME default expression.

If you want to think about REALLY awful syntax, consider the possibility of
specializing on the svar predicate of an &OPTIONAL parameter:

(DEFMETHOD PRINT-SOMETHING
  ((X MY-THING)
   &OPTIONAL ((STREAM SPECIAL-STREAM)
	      *DEFAULT-STREAM*
	      (STREAM-SUPPLIED (EQL NIL))))

This method obviously ;-) gets run when the STREAM argument is not supplied and
its default value in *DEFAULT-STREAM* is a SPECIAL-STREAM.
--
Internet: bane@tove.umd.edu
UUCP:...uunet!mimsy.umd.edu!bane
Technical Details
Message-ID: <31747@mimsy.umd.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!news.cs.indiana.edu!ux1.cso.uiuc.edu!midway!mimsy!tove.cs.umd.edu!bane
References: <9103181745.AA18191@mingus.mitre.org>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!news.cs.indiana.edu!ux1.cso.uiuc.edu!midway!mimsy!tove.cs.umd.edu!bane
From: bane@tove.cs.umd.edu (John R. Bane)
Newsgroups: comp.lang.clos
Subject: Re: Beefs (moooo!) about lambda list congruency
Message-ID: <31747@mimsy.umd.edu>
Date: 20 Mar 91 01:54:55 GMT
References: <9103181745.AA18191@mingus.mitre.org>
Sender: news@mimsy.umd.edu
Reply-To: bane@tove.cs.umd.edu (John R. Bane)
Distribution: inet
Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
Lines: 37