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: setf.scm


Mikael Djurfeldt <mdj@nada.kth.se> writes:

> constructor: (make-procedure-with-setter GETTER SETTER)
> selector:    (procedure-getter PROCEDURE-WITH-SETTER)
> selector:    (procedure-setter PROCEDURE-WITH-SETTER)

Or maybe:

  make-getter-with-setter
  getter
  setter

and, of course,

  getter-with-setter?

> If our `define-class' macro binds accessors, there now occurs the
> question whether we should let the method of the getter generic
> function be a procedure-with-setter or if the getter should be a
> procedure-with-setter consisting of a generic function getter and
> setter.
> 
> The former alternative (method is p-w-s) requires that set! does the
> method lookup.

Just to clearify: If the getter and setter are stored in the method of
a generic function, set! needs to do a dispatch on the getter
arguments in order to retrieve the setter:

In the Goops-free Guile, (set! (G A1 ...) V) will be expanded to
((setter P) V A1 ...).  What I'm saying is that if the
getter-with-setter pair is stored in the procedure slot of the method,
P needs to be calculated from G by dispatch on A1 ...

Sigh... maybe the other alternative (letting the object system treat
getter-with-setters whose getter is a generic function as a generic
function) is better anyway.

(Yes, this whole issue would have a very simple answer if Guile had
 the object system builtin.)

/mdj