Side-effect free containers for E
Ralph Hartley
hartley@AIC.NRL.Navy.Mil
Thu, 10 Aug 2000 08:48:49 -0400
> "Mark S. Miller" <markm@caplet.com>:
> OTOH, I'm scared of having both
>
> container[key]= newValue
>
> and
>
> container[key]:= newValue
>
> be legal in the same language with very different meanings.
I'm afraid that would be right up there with = vs == in C on the bug
parade. If you add the first you must eliminate the second. I haven't
been able to think if a syntax that bakes the distinction clear but
still follows (historically based) intuition. Perhaps it is ok to make
it a little jarring to discourage thoughtless use, for example
[key]container := newvalue
On the other hand [key]= seems very natural. However it does require
that [key] be an operator:
container [key]=newvalue --> container := container [key] newvalue
so
container [key] newvalue --> container with(key,newValue)
So [key] acts as a binary operator to produce a new collection, as an
right unary operator to extract a value, and as a left unary operator
to produce an "L-value".
A little messy I admit.
Ralph Hartley