This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Suggestion for strings.c
Jost Boekemeier <jostobfe@calvados.zrz.TU-Berlin.DE> writes:
> > (let* ((v (gensym 'location-value))
> > (trans `(make-procedure-with-setter
> > (lambda () ,place)
> > (lambda (,v) (set! ,place ,v)))))
>
> Does this mean that generalized set! is actually a procedure call?!?
no. this means that "dereferincing" a location is a procedure call.
nothing to do with set! per se.
> I hope not. From reading the SRFI I got the impression that:
>
> a) it suggests that a "getter" procedure returns a location and
> set! changes this location.
wrong. it suggests that a getter returns a value, and (setter getter)
returns a procedure that changes that value. nothing to do with locations.
> b) this is not how it is implemented. In fact (set! (getter object) val)
> is just syntactic shugar for (setter object val).
what do you mean by "not how it is implemented"?
> I think that both a) and b) are dangerous (and of course their
> combination is even more dangerous):
>
> a) with the message oriented style (which goops supports) an object
> protects itself from being modified.
Goops objects don't protect themselves from being modified.
a big chunk of the rest of your post stems from the earlier
misunderstandings, so I'll just snip it:
> [ snip ]
>
> As you probably know a location may either be exported
>
> 1 not exported at all
>
> 2 immutable
>
> 3 mutable but specified modification (see set-validate-counter-value)
>
> 4 mutable
no, I don't know that. does the above have any relation to Scheme?
if not, what is the context?
> The problem is here that generalized set! is not general enough as
> it can only be used to change type 4 locations. Also the syntax
> (set! (x y) val) is a bad replacement for the more descriptive setter
> "set-counter-value".
leaving aside the question of taste (I think it's a good replacement),
you are wrong here. you set the setter to set-validate-counter-value,
et voila.
> It is true that without generalized set! you must remember the
> name of the setter('s) and the getter. But note that in general
> you must not only know the name of a specific setter but also the
> contract you've signed by using this setter (the setter may only
> accept a range of values etc.).
leaving aside the fact that I don't see the context of this discussion
about "message passing", "contract" and "signatures", I think you miss
something important: the generalized set! is pure syntactic sugar, as
are locations. if, in your design, a contract (whatever that means)
can be broken just by syntactic deviation, then your design (where it
concerns contract enforcement) is bad.
> I think that #:accessor and generalized set! should be removed from
> goops.
not that I get to decide anything, but nah.
> Jost
--mike
--
You can sing to my cat if you like.