Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!uunet!cme!cam!ARTEMIS From: miller@GEM.cam.nist.gov (Bruce R. Miller) Newsgroups: comp.lang.lisp Subject: Re: structures Message-ID: <2881952343@ARTEMIS.cam.nist.gov> Date: 29 Apr 91 22:19:03 GMT References: Sender: news@cam.nist.gov Followup-To: comp.lang.lisp Organization: NIST - Center for Computing and Applied Mathematics Lines: 32 In article , John McCarthy writes: > The fact that using slot names as functional arguments requires > special hacks in Lisp is a consequence of the Lisp definers > of objects blindly following the mistakes of Pascal, etc. > CAR and CDR are slot names essentially, and from the very > beginning they were treated as function names. Perhaps I'm missing the point, but there seems to be nothing designed into lisp that is requiring the special hacks, rather the particular request is. With a (DEFSTRUCT MYPAIR CAR ...) the slot CAR can easily be accessed via a symbol MYPAIR-CAR and the generalized accessor is trivially written using FUNCALL. But unfortunately (for reasons I'm unclear about), what was desired was (ACCESSOR STRUCTURE 'CAR) rather than (ACCESSOR STRUCTURE 'MYPAIR-CAR) Is the prepending of "MYPAIR-" the mistake of Pascal that you refer to? It can be arranged to have the accessor defined as CAR (using (:CONC-NAME "")), but (short of CLOS) there can only be one such function in the package, and in particular no other slots named CAR. It seems to me that the solution to the problem would be either to take a step `backwards' and use alists, or a step `forwards' and use CLOS. Or some combination thereof.