This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

setf.scm


I am still unhappy about the foo/set-foo! accessor scheme.

I still think autogenerated symbols are a problem. In my mind there is
a difference between asking for one name `foo' (and just getting that)
and the situation where another, slightly different, name is
introduced too (whatever its name is).

Not only do we now get the extra name, we also overwrite any already
existing function as well. And the problem will multiply as we extend
it to other areas, such as records. So we are not only forcing one
accessor convention on our users, we are also interfering with their
use of similar conventions elsewhere in their programs.

Supposing a particular user thought this was very bad. He is now in
some troubles. Asking him to refrain from using #:accessor's and
instead spell each getter and setter out is not going to make him
happy, and changing the behaviour of the system is difficult. It is
actaully possible with goops, but will require a deeper understanding
of the mechanics (perhaps also modifications to the class hierarchy of
the users application).

And suppose the convention was used also for other things (such as
records), then we are really asking our unhappy user to stand on his
head in the guts of guile.

Contrast this with the setf! convention. Setf! has the nice property
of (sort of) introducing a separate setter name space. So you are free
to have a `car' slot with an #:accessor. It is also much easier to
change. If I really really wanted a proper function, it could write a
plain macro that would call `define-class' and then go over the slot
definitions for occurrences of #:accessor generating the necessary
functions.

The bottom line is IMHO that somebody should decide whether we want
this look like CLOStrt (CLOS the real thing) or STk, or whether we
want a minimalistic library kind of thing upon which users can build
their own conventions. 

Inventing yet another and incompatible way of doing things would not
be a productive choice, as I see it. Especially since this (the
set-foo! scheme at least) will make it different for users to choose
differently.

I am (if anybody should be in doubt :-) in favour of going CLOStrt and
the concept of setf!.


---------------------------+--------------------------------------------------
Christian Lynbech          | Telebit Communications A/S                       
Fax:   +45 8628 8186       | Fabrik 11, DK-8260 Viby J
Phone: +45 8628 8177 + 28  | email: chl@tbit.dk --- URL: http://www.telebit.dk
---------------------------+--------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
                                        - petonic@hal.com (Michael A. Petonic)