[E-Lang] Hydro & E operator expansions
Tyler Close
tclose@oilspace.com
Thu, 22 Mar 2001 10:57:27 -0000
Chip wrote:
> When a C-tradition programmer writes
>
> foo += 3;
>
> even though they know it is equivalent to
>
> foo = foo + 3;
>
> they think of it as "add 3 to foo". They don't think of it as a
> side-effect-free operation on 3, they think of it as a
> modification of foo.
Is this an argument in favour of option 2?
"2) Tyler suggests having "+" expand to "with", in which case we could
simply
write:
map += (key, newValue)"
> The variable foo is seen as a container whose contents are
> altered by the
> operation. Adding an element to a collection is similarly
> seen as an alteration
> to the contents of a container.
>
> For a C or C++ or Java programmer, the introduction of
> immutable collections is
> very disorienting.
Would this slight of hand get rid of the disorientation?
Tyler