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! Per Bothner 18 Aug 2015 16:39 UTC

On 08/18/2015 02:32 AM, Taylan Ulrich Bayırlı/Kammer wrote:
> I was thinking that it wouldn't work for cases like
>
>      (set! (documentation-of foo) "Foobar.")
>
> since in (set! (vec i) x), the order within the (vec i) form is
> (<object> <field>), meaning that the above would have to be interpreted
> as wanting to set the `foo' field of a procedure object.
>
> However, that can be salvaged by specifying that the (<object> <field>)
> order only arises from omission of an explicit getter in the first
> position, and prohibiting this omission when <object> is a procedure.
>
> In simpler words, the `setter' procedure knows the object it received to
> be already a getter when it's a procedure, and otherwise looks up the
> getter based on the type of the non-procedure object it received.

That's an awkward way of putting it.

The 'setter' procedure doesn't know anything about getters per se.
It just assumes procedures and other applicable values (such as vectors)
may have associated properties, and it looks up the 'setter property
of its argument.  The rest is a matter of convention and design.

Of course "looking up the 'setter property" of an object is conceptual.
In Kawa a vector doesn't have general properties, and typically
(setter X) is resolved at compile-time.
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/