🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clos
Article #516

Re: SLOT-VALUE and structures

#516
From: Jeff Dalton
Date: Thu, 18 Apr 1991 14:05
43 lines
2574 bytes
> [I suspect this question will continue to come up on this list for some
> time; hence I will take the time here to outline what I think the main
> concerns are for retaining the historic "lean" definition for DEFSTRUCT,
> even in the face of the addition of CLOS.]

I don't particularly care whether SLOT-VALUE works with structures.
Indeed, I think SLOT-VALUE is in some ways a step backwards, like
using symbols for variables.

However, I would like to be able to (1) find out what slots there are
and (2) get the accessors and setters for the slots.  This sort of
thing comes up very often, for one reason or another, and people have
resorted to writing macros that sit on top of DEFSTRUCT and record the
necessary information.  I've done this myself a couple of times too.

Implementations have this information at some point and then perhaps
get rid of it.  I can accept the point that Common Lisp has enough
problems with image size without adding another.  A possible low
impact solution might be to add a DEFSTRUCT option that specifies
whether the "meta" information is required at run-time.

> re: For several *years* the standard answer to the question ``How do I
>     access an arbitrary slot in a structure instance?'' has been
>     ``Use SLOT-VALUE (when CLOS is available).''
>
> You forgot the part about STANDARD-CLASS, whose default behaviour
> is to retain the "meta" information in the image; i.e., convert
> over from use of DEFSTRUCT to use of DEFCLASS.

STANDARD-CLASS brings a lot of other stuff with it that one may not want.

> Compare the "conventional computer languages" world [my apologies for
> invoking the "C" word here]; are the struct definitions parsed by the
> compiler "saved" in the A.OUT for, say, hello-world?

The symbol table is typicaly there, unless you "strip" it.  Files
compiled for symbolic debugging (-g) have structure information.

In any case, there are many things C structs don't have.  For example,
they don't have a printed representation.  That C structs lack
something isn't much of an argument for having the same lack in CL.

-- Jeff
Technical Details
Message-ID: <8009.9104181405@subnode.aiai.ed.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!bionet!agate!usenet.ins.cwru.edu!tut.cis.ohio-state.edu!unreplyable!garbage

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!bionet!agate!usenet.ins.cwru.edu!tut.cis.ohio-state.edu!unreplyable!garbage
From: jeff@aiai.edinburgh.ac.uk (Jeff Dalton)
Newsgroups: comp.lang.clos
Subject: Re: SLOT-VALUE and structures
Message-ID: <8009.9104181405@subnode.aiai.ed.ac.uk>
Date: 18 Apr 91 14:05:21 GMT
Sender: welch@tut.cis.ohio-state.edu
Distribution: inet
Organization: CommonLoops
Lines: 43