Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Historical syntax query

74 views
Skip to first unread message

Robert Virding

unread,
May 30, 2016, 9:35:19 AM5/30/16
to
Defining structs and classes needs very similar types of parameters. You need a struct/class name, struct/class options and struct components or class slots (these are pretty much the same thing). For classes you can also have super classes. However the syntax for defining is different:

(defstruct (<struct-name> <struct-options>)
<components>
)

(defclass <class-name>
<super-classes>
<slots>
class-option
...
)

Does anyone know WHY they are different? Is there any fundamental reason for them to be different? Or was it just what the guy who implemented them that decided this?

Both of these features pre-data CL. They were at least in Lisp Machine lisp (though classes were called flavors) were they had the same basic different structures so the CL syntax is not new. My question then goes further back.

I know this question is basically irrelevant but it would be interesting to know if there was reason it became like this, or did it just happen?

Robert

Rainer Joswig

unread,
May 30, 2016, 10:49:59 AM5/30/16
to
On 2016-05-30 13:35:15 +0000, Robert Virding said:

FYI: Lisp Machine Lisp had a CLASS system (with DEFCLASS) before it had
Flavors and long before CLOS:

http://lispm.de/source/lispm-system-78-48/lispm2/class.lisp

Barry Margolin

unread,
May 30, 2016, 9:02:39 PM5/30/16
to
In article <23a85458-e885-46c6...@googlegroups.com>,
Most defining macros are of the form

(defWHATER <whatever-name> ...)

DEFSTRUCT is the odd man out in this pattern, and I guess the creators
of DEFCLASS didn't want to copy that mistake.

It also may be related to the fact that DEFSTRUCT was originally created
for MACLISP, which didn't have keywords. So there was no way to put
structure options in the body along with the list of slots -- they would
look like slot definitions. But when DEFCLASS was created, we could
depend on the fact that keywords can't be used as slot names, so a list
beginning with a keyword must be a class option rather than a slot
specification.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***

Marco Antoniotti

unread,
May 31, 2016, 2:05:14 PM5/31/16
to
Actually all defining forms are like

(def <what> <some spec> ...)

As long as you use DEFINER (from common-lisp.net) :) :) :)

Cheers
--
MA

Robert Virding

unread,
Jun 28, 2016, 7:33:40 PM6/28/16
to
Thanks for the replies. I was just curious. I personally prefer as it is done in defflavor/defclass as it seems more logical.

Robert
0 new messages