| From | Sent On | Attachments |
|---|---|---|
| Guillaume Laforge | Mar 2, 2009 2:16 am | |
| Dierk König | Mar 2, 2009 2:38 am | |
| Guillaume Laforge | Mar 2, 2009 3:01 am | |
| Dierk König | Mar 2, 2009 3:40 am | |
| Guillaume Laforge | Mar 2, 2009 3:53 am | |
| melix | Mar 2, 2009 3:56 am | |
| Guillaume Laforge | Mar 2, 2009 3:58 am | |
| Paul King | Mar 2, 2009 4:11 am | |
| Guillaume Laforge | Mar 2, 2009 4:23 am | |
| Tom Nichols | Mar 2, 2009 4:39 am | |
| Michael Mellinger | Mar 2, 2009 5:10 am | |
| Martin C. Martin | Mar 2, 2009 5:31 am | |
| Tom Nichols | Mar 2, 2009 6:19 am | |
| Robert Fischer | Mar 2, 2009 6:25 am | |
| Robert Fischer | Mar 2, 2009 6:38 am | |
| Tom Nichols | Mar 2, 2009 6:50 am | |
| Graeme Rocher | Mar 2, 2009 6:55 am | |
| Alex Tkachman | Mar 2, 2009 7:06 am | |
| Robert Fischer | Mar 2, 2009 7:07 am | |
| Robert Fischer | Mar 2, 2009 7:13 am | |
| Alex Tkachman | Mar 2, 2009 8:18 am | |
| Robert Fischer | Mar 2, 2009 8:58 am | |
| Guillaume Laforge | Mar 3, 2009 1:39 am |
| Subject: | [groovy-dev] Suggestions for @Immutable | |
|---|---|---|
| From: | Guillaume Laforge (glaf...@gmail.com) | |
| Date: | Mar 2, 2009 2:16:07 am | |
| List: | org.codehaus.groovy.dev | |
There's a comment on my InfoQ article on Groovy 1.6 about @Immutable:
http://www.infoq.com/articles/groovy-1-6#view_39652
Some interesting thoughts:
*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 implementation.
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.
Example: 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 data.
Support for immutable types is critical as more people attempt to embrace multi-core machines through message based concurrency or side-effect free functional programming. *
Perhaps some of these suggestions would be nice to have? What do you think?
-- Guillaume Laforge Groovy Project Manager Head of Groovy Development at SpringSource http://www.springsource.com/g2one





