[Haskell-cafe] Structural sharing in haskell data structures?

Andrew Wagner wagner.andrew at gmail.com
Wed May 13 08:58:57 EDT 2009

> So far as I know, all immutable languages do it. Like Don, I think the
> reason it's emphasized so much in Clojure is because of trying to convert
> the Java crowd and introducing them to immutability. With mutable languages
> you have to clone _everything_ for fear of later changes affecting earlier
> copies. Because of this, folks used to mutable languages often erroneously
> suppose that immutable languages do the same thing. There's a lot of FUD in
> the mainstream about declarative/immutable/functional languages and their
> performance behavior.
> The idea is simple and you can do it in mutable languages perfectly well
> (clone the changed part of the spine, point to old substructure) so long as
> you're careful not to do mutation, e.g. by marking everything "final". You
> don't see it as much in mutable languages because people get squeamish about
> the first step: clone the changed spine; they'd much rather mutate it. In
> heavily GCed languages like Haskell allocation and collection is cheap, so
> we don't mind too much; but in Java and the like, both allocation and
> collection are expensive so the idea of cheap throwaway objects is foreign.

Are you guys saying that the Clojure target audience is current Java
programmers, whereas Haskell's is people who already do functional,
immutable programming? Because how long the technique has been used, or how
widespread it's used, is irrelevant when trying to convince someone who
doesn't have experience with immutable data structures that it's not
completely insane.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090513/a0746fc2/attachment.html

More information about the Haskell-Cafe mailing list