Re:Notes on Distributed Systems for Young Bloods (2013)
by notacoward on Monday August 08, 2016 @01:50PM
(#12249572)
So, best case, with proper type annotation and a really good optimizer, you get the performance you would have had with plain old mutability? Pardon me if I remain unconvinced that immutability is solving the problem adequately.
Re:Notes on Distributed Systems for Young Bloods (2013)
by catnaroek on Wednesday August 10, 2016 @12:28PM
(#12262930)
> you get the performance you would have had with plain old mutability
And muuuch better type safety. You can only mutate data in-place if either no one else has access to it, or it's wrapped in a mutex and you've taken a lock.
(0) If the object has, say, just two or three fields (which isn't uncommon in functional languages, since they really tend to decompose everything in a piecemeal fashion), this is no big deal.
(1) If a functional language has substructural types (which admittedly most don't), the compiler can even tell, purely from type information, when an object won't be used anymore and can be overwritten anyway, as though you had used imperative assignment all along.