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: Generalized set!


Per Bothner <bothner@cygnus.com> writes:

> >   (set! (PWS A1 ...) V) --> ((SETTER PWS) A1 ... V)

> That is why Kawa has the new value first in the setter:
>   (set! (PWS A1 ...) V) --> ((SETTER PWS) V A1 ...)
> 
> For most users, it shold not matter which we choose.  They will
> use the generalized set!, but are unlikely to define new setters
> themselves.  Most setters functions have fixed arity, so which
> end to add the rhs does not matter.  The tradeoff is:
> 
> * Putting the rhs last is perhaps more natural.  It is certainly
> more consistent with most existing Scheme fucntions.  It also
> allows the implementation to use exising xxx-set! functions
> as (setter xxx) without an intermediate step.
> 
> * On the other hand, putting the rhs first works a lot better
> for varags functions, and is much more consistent with how
> most varargs functions are used and defined.
> 
> There is no definite "correct" answer; we have conflicting
> tradeoffs.  I do want to make sure people are aware of those
> tradeoffs.  Kawa puts the rhs argument first, to the extent
> that is relevant, though I guess I might be convinced to
> change it.

This is a good description of the situation.

I don't have any further arguments.

I just turned it around in my head for several days, then settled for
your proposal, implemented it, started to use it, and then just got
this feeling that this is not how I'd like a scheme interpreter to
behave.

*All* aspects of RnRS are so beautiful and intuitive.  When you read
it the first time you just become so happy.

It is my subjective view that the second transformation above would
break against that pattern.

I'll leave this for Jim to decide, either by himself or with a poll.

(Thanks for your contribution to the discussion.  The
 procedure-with-setter type was a nice idea.)

/mdj