1

Closed

Rethink "dot" notation

description

This is somewhat related to the field access issue (#1).
a.b
is currently just a shorthand and gets rewritten by
b(a)
whereas
a : a
b : (a) -> x
This might be easy to implement, but limits the dot notation to field access forever. It would be nice if dot notation can be used for setting as one is used to it in all other languages.
val x = ..
val x.foo.bar = "heho"
I propose this to be valid syntax with following semantics:

The assignment shadows the existing binding of name x with a new object that equals the one designated by x before but with the field bar in field foo replaced by "heho".
This resembles imperative programming with mutable data as most people are used to it from the languages they know, but is still purely functional.
Closed Sep 21, 2012 at 6:40 AM by lpeterse
Discussed with Daan. Problem solved.

comments