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



bothner@cygnus.com writes:
> In earlier discussions on this topic, we talked about a generalized
> set! form.  Now, suddenly everyone is talking about setf!.  Why
> this sudden poorly-motivated name-change?
> 
> Common Lisp provides setf as a generalization of setq.  Well, we
> can use setf! as a generalizion of set!, but it makes a lot more
> sense to me to use set! as a generalization of set!.
> 
> * Using (setf! (...) ...) instead of (set! (...) ...) adds a
> needless top-level name, adds conceptual clutter, and is likely to
> lead to more silly mistakes (as people use one where they should
> have used the other).
> 
> * If we provide a "paren-reduced" surface syntax for Scheme (as I
> intend to do), it is much simpler if we can just say that:
> 	LHS := RHS
> is translated into:
> 	(set! LHS RGS)
> 

I'm not sure if the setf code in CVS does this, but it's trivial to
make (setf! place value) expand to a set! if the place is simply a
variable name. The earlier implementation of setf! I posted did that.

One problem with calling setf! set! instead in Guile is that the
primitive set! exists, and having a loadable module which changes the
behavior of primitive syntactic forms is perhaps not a good idea.

> * Generalized set! is what I have implemented in Kawa, and I am not
> going to rename it.
> 
> As a reminder of previous discussions:
> 	(set! (PROC ARGS ...) RHS)
> is (in Kawa at least) equivalent to:
> 	((setter PROC) RHS ARGS ...)
> (The RHS becomes the first arguemnt to the setter because of the
> need to support var-args 

Hmm, is your set! static or dynamic (in the earlier terminology of
this discussion, see archive if necessary)?

 - Maciej