Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsfeed.cit.cornell.edu!newsstand.cit.cornell.edu!news.kei.com!newsfeed.internetmci.com!EU.net!uknet!newsfeed.ed.ac.uk!edcogsci!jeff
From: jeff@cogsci.ed.ac.uk (Jeff Dalton)
Subject: Re: defstruct
Message-ID: <DHMrvs.924@cogsci.ed.ac.uk>
Organization: Centre for Cognitive Science, Edinburgh, UK
References: <jean-marc.pezeret-0311951112240001@stkm06.alcatel.no>  <rscg2g53fl5.fsf@liasg6.epfl.ch> <DHJ0Bw.Cy3@cogsci.ed.ac.uk>  <eliot-0511952052340001@a-02.das.mcgill.ca> <eliot-0611950140470001@i-15.das.mcgill.ca>
Date: Mon, 6 Nov 1995 16:45:21 GMT
Lines: 33

eliot@phoenix.princeton.edu (Dr. E. Handelman) writes:

>In article <eliot-0511952052340001@a-02.das.mcgill.ca>,
>eliot@phoenix.princeton.edu (Dr. E. Handelman) wrote:


>> (defmacro (defstruct* opts . slots)
>>    (let ((struct-name (if (consp opts) (car opts) opts)))
>>      `(progn
>>        (setf (get ',struct-name 'original-defstruct-slots) ',slots)
>>        (defstruct ,opts ,@slots))))


>Oops! I forgot about :INCLUDE. Here's a revised version:

That's excellent, and simpler than I expected, largely because
it leaves slot-psrsing to the user, which is ok: someone can
just provide some utility functions.

>;;; DEFSTRUCT* saves slotnames for STRUCTURE-SLOTS, following the
>;;; :INCLUDE link if necessary 

Remember that :include can override slot specs from the parent.
The full :include syntax is (:INCLUDE name slot-description*).

It would also be useful to save the parent name as well as the
slot specs.

Another complication: to _access_ the slots, you need to know
that names of the access functions, and for that you need to
look at the :conc-name option.

-- jeff
