[LRUG] The advantage of immutability?
Tom Stuart
tom at codon.com
Thu Sep 10 02:39:31 PDT 2015
On 10 Sep 2015, at 10:34, Stephen Best <bestie at gmail.com> wrote:
> In every example I've seen immutability has certainly required more effort, but I don't think this always correlates with more complexity.
This reminds me (belatedly) of a bit I wrote last year, on implementing immutable trees: http://codon.com/notes-on-counting-tree-nodes#immutable-trees
I wrote that in an attempt to demonstrate how immutability can be useful — in that particular case, by making a data structure correct by construction, rather than having to write extra code to deal with malformed trees and so on. So I think that’s a decent example of how “more effort” (to implement the operations without mutation) leads to “[less] complexity” (because the resulting code is ultimately simpler to work with).
Cheers,
-Tom
More information about the Chat
mailing list