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]

Re: generic method names for collections


>>>>> "Jay" == Jay Glascoe <jglascoe@jay.giss.nasa.gov> writes:

Jay> On Sun, 8 Nov 1998, Maciej Stachowiak wrote:
>> (set! (vector-ref vector 0) "foo")
...
Jay> no offense, but that's just plain ugly.

It may be ugly (to some) but it is simple, in the sense that whatever
you use as deconstructor, you may use as an argument to the generic
modifier function.

As it is now, each and every type has its own set of accessor/modifier
function, which may be ok for "standard" types such as list and
vectors, but is a pain when we are talking user-defined types such
as records or objects.

I find 
       (setf! (foo oo) 123) 
preferably to something like 
       (object-set! oo 'foo 123)
or having to specify somehow (magically or explicitly) that
       (foo! oo 123)
is a way to modify the foo slot. Sometimes I will want that, but
having the generic option as well would be nice.


---------------------------+--------------------------------------------------
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)