This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: macro for record definition
- To: Stan Pinte <stan dot pinte at wanadoo dot be>
- Subject: Re: macro for record definition
- From: Per Bothner <per at bothner dot com>
- Date: Thu, 18 Oct 2001 15:21:35 -0700
- CC: kawa at sourceware dot cygnus dot com
- References: <5.1.0.14.0.20011018094900.00b9eed8@mail.wanadoo.be>
Stan Pinte wrote:
> would someone have contributed a macro, enabling to define in one shot
> a constructor, and all the accessors for the slots of a record,
> to get rid of the use of functions like:
>
> make-record-type, record-constructor, ...
>
> I would like to have such a macro, to which I can pass the record
> name, the record slots, and this macro would expand to a definition of
> all the accessors, of a constructor, of the record-precidate, ...
First, I recommend against make-record-type and related functions, if
you can
conveniently use one of the alternatives, because they create new
classes at run-time,
and require runtime reflection. That is why I would not accept any
addtion to Kawa
that depends on make-record-type.
My preference is to build on define-class syntax. The plan is that this
will support most
of the features of CLOS or GOOPS (a CLOS like OO system used in Guile).
It should
be possible to write a macro like you want.
What I would like is to add an implementation of SRFI 9 "Defining Record
Types"
(http://srfi.schemers.org/srfi-9/srfi-9.html). This can be implemented
on top of
make-record-type fairly easily (the SRFI 9 document provides an
implementation),
though it would be better to define it using define-class. That should
not be very
difficult