*Great to see that the groovy team is embracing immutability as a critical
part of the language.
Can methods require @immutable arguments and return types? That would make
it possible to write side effect free functions that can be parallelized. If
the compiler can enforce immutability, then it would be trivial to write an
erlang-like messaging library or a a parallelized linear algebra
Also, immutable types should also generate modifiers for all properties.
Otherwise, working with immutable types is cumbersome and involves a lot of
boilerplate copying of fields between objects.
def c1 = new Coordinates(latitude: 48.824068, longitude: 2.531733)
def c2 = new Coordinates(48.824068, 2.531733
//copies the prior longitude, and sets the latitude to the provided value
def c3 = c2.modify(latitude:49.13123)
This is a trivial example, but in practice data structures can be large and
complicated, so it should be trivial to create slight variations of existing
Support for immutable types is critical as more people attempt to embrace
multi-core machines through message based concurrency or side-effect free
Perhaps some of these suggestions would be nice to have?
What do you think?