🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clos
Article #246

Re: defmethod setf expansion

#246
From: Barry Margolin
Date: Tue, 27 Nov 1990 07:29
26 lines
1605 bytes
In article <1990Nov27.023907.10083@athena.mit.edu> janson@athena.mit.edu (James A Anderson) writes:
>does anyone know why the arguments are reversed in the function
>which is generated by a defmethod for a setf function?

This is so that the <place> argument to SETF may include keyword, optional,
and rest parameters.  If the <value> argument were last it wouldn't be
possible to precede it with optional or keyword arguments.  The method
might need to specialize on the type of the value argument, but only
positional arguments may be specialized.  And no arguments can follow
keyword arguments.

So, it's not really the case that the arguments are *reversed*.  The
arguments are in the same order, except that the value argument is moved to
the front.

For a simple example, consider the function that SETF of AREF must expand
into a call of (in Zetalisp it's called ASET).  It should take the
subscripts as an &rest argument just as AREF does.  So where does the value
argument go.  In Zetalisp, the argument list is (new-value array &rest
subscripts).

--
Barry Margolin, Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar
Technical Details
Message-ID: <1990Nov27.072907.17229@Think.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!think.com!barmar
References: <1990Nov27.023907.10083@athena.mit.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!think.com!barmar
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.lang.clos
Subject: Re: defmethod setf expansion
Message-ID: <1990Nov27.072907.17229@Think.COM>
Date: 27 Nov 90 07:29:07 GMT
References: <1990Nov27.023907.10083@athena.mit.edu>
Sender: news@Think.COM
Organization: Thinking Machines Corporation, Cambridge MA, USA
Lines: 26