function-call notation instead of generic ref/set! Per Bothner (16 Aug 2015 18:10 UTC)
Re: function-call notation instead of generic ref/set! taylanbayirli@xxxxxx (17 Aug 2015 08:34 UTC)
Re: function-call notation instead of generic ref/set! Per Bothner (17 Aug 2015 16:39 UTC)
Re: function-call notation instead of generic ref/set! taylanbayirli@xxxxxx (18 Aug 2015 09:32 UTC)
Re: function-call notation instead of generic ref/set! Per Bothner (18 Aug 2015 16:40 UTC)

Re: function-call notation instead of generic ref/set! taylanbayirli@xxxxxx 17 Aug 2015 08:34 UTC

Per Bothner <xxxxxx@bothner.com> writes:

> I will not implement this for default-mode Kawa (i.e. not requiring
> an import) because Kawa already has a cleaner and more concise notation:
> Treat a vector/list/string as a pseudo-function:
>
> #|kawa:1|# (define vec1 #(a b c d))
> #|kawa:2|# (vec1 2)
> c
> #|kawa:3|# (define vec2 (vector-copy vec1))
> #|kawa:4|# (set! (vec2 2) 'C)
> #|kawa:5|# vec2
> #(a b C d)
> [... snip ...]

That's a pretty nice idea, but having

    (set! (x y ...) z)

equal

    ((setter x) y ... z)

has been around since SRFI-17, and is apparently even baked deep into
some Scheme implementations (at least, Guile).

So, it's an unfortunate difference but I guess we'll have to live with
it.

Well, it might still be possible to have a smart implementation of
`setter' which does the right thing, but that would be pretty awkward,
and currently I don't see the "applicable data structures" syntax
catching on in Scheme.

Taylan