From: Kevin Haddock
Subject: lists as function names in clos, e.g. (setf name)
Date: 
Message-ID: <35914680.5E0749C5@ecst.csuchico.edu>
Hi All:

I am having a problem getting oo-Browser to work on the XIT system and I
think I may be onto what is going on but I would like someone to try to
explain it a little better to me than cltl2 seems to be doing.

Cltl2 says that when you use the slot option :accessor it creates a
function (method?) of <accessor-name> to retreive the slot and a
function with the name (setf <accessor-name>)  (Cltl2 Sect 28.1.2.4
paragraph 4) to set it.  Now I am getting the impression that a function
can have a list as its name (however the calling syntax of (setf (fubar
a) "hello"), where fubar is the slot accessor and a is the variable
containing the object and "hello" is the string you desire to set the
slot to, still escapes me.  How is that having  a list be the  function
name and how does the system derive the accessor-name of 'fubar from
(fubar a)???)  A couple of chapters later Cltl2 implies that the only
way a method is recognized with a list as its name (e.g. the setf
example above) is if the car is setf?  (If this is true this is awfully
awkward syntax for your  interpreter to be looking out for, IMHO).

Now when I try to oo-browse the XIT system I have a problem with the
kernel/streams.lisp file and it appears to be related to this thing
about having lists for a function/method name.  It would appear that the
oo-browser's regexps are not prepared for that syntax.  (I am using the
latest free version of oo-browser, the one that came with xemacs 20.4
under Redhat 5.0, BTW).

I follow the journey of point through streams.lisp and everything goes
along fine until it runs into this form (in pertenent part):

;;; PLEASE mail an implementation for YOUR lisp to
···········@dsg.csc.ti.com
#+(and lispm (not clos))
(defun (:property interactive-stream si:named-structure-invoke)
    (method self &rest args
     &aux (operations '( :which-operations :operation-handled-p
:send-if-handles
...

After that it gets out of sync and bombs on the following form:


#+(and Explorer CLOS)
(progn

;; may 12/14/89 Hook READ function into interactive-stream
(defmethod (interactive-stream :rubout-handler) (options function &rest
args)
  ;Args are args to FUNCTION, the first arg being the stream.
  (apply #'stream-rubout-handler zl:self options function args))

with the following debugger backtrace (in pertinent part):

Signaling: (invalid-read-syntax ")")
  read(#<buffer "*oobr-tmp*">)
  (let ((aliased-function ...) arg-list) (setq aliased-function
(condition-case nil ... ...)) (if (null aliased-function) nil (setq
arg-list ...) (if arg-list ...)))
)
  (if (= (following-char) ?\() (buffer-substring (point) (progn ...))
(let (... arg-list) (setq aliased-function ...) (if ... nil ... ...)))
)
  clos-scan-routine-arglist()
  (if (string-match clos-def-form-with-args-regexp def-form)
(clos-scan-routine-arglist))
)
...

There are several other places where a similar thing occurs in the
dispels files.  Also I get a problem with the system not being able to
handle autoload in regards to a function "background".

I really would like to browse XIT with this tool because I am getting a
segmentation violation that I am finding difficult to track down.  I am
somewhat new to lisp so sorry if these questions are infantile.  I have
been RTFMing until I am about to go blind!

Thanks in advance,

-Kevin

········@ecst.csuchico.edu
From: Kent M Pitman
Subject: Re: lists as function names in clos, e.g. (setf name)
Date: 
Message-ID: <sfwbtrizdyt.fsf@world.std.com>
Kevin Haddock <········@ecst.csuchico.edu> writes:

> Now I am getting the impression that a function
> can have a list as its name

Only two-lists whose car is SETF, but yes.

>(however the calling syntax of (setf (fubar
> a) "hello"),

Well, nothing wrong with just (SETF (FUBAR A) "hello")
provided there is a 

 (defmethod (setf fubar) (new-value obj) ...)

someplace.  But you can also call it as 

 (funcall #'(setf fubar) "hello" a)

The system doesn't "derive" the accessor name.  SETF is simply
defined to first look for things define by DEFSETF and DEFINE-SETF-METHOD
and if not found to effectively do
 `(funcall #'(setf ,(car place)) ,new-value-form ,(cdr place))
[ignoring issues of evaluation order, which are also dealt with].

For more information, I recommden the Common Lisp HyperSpec(TM),
which describes ANSI CL, and which is available online at:
 http://www.harlequin.com/education/books/HyperSpec/FrontMatter
It's bit (16MB), but it can also be downloaded for personal or local
site use by instructions available at:
 http://www.harlequin.com/education/books/HyperSpec/