Not that I want or need to defend C++ on this list, but reference-counted smart pointers (e.g. boost::shared_ptr<>), embedded inside copy-on-write proxy classes, largely simulates eager garbage collection. Targeted overriding of the new operator can make this lazier for efficiency.

In other words, there are well established idioms in most successful languages to solve obvious problems. Haskell's strengths are more in making these idioms simple and robust enough for the average user, not just the guru, and to make difficult or impossible the misuse of unsafe idioms.

Dan

Don Stewart wrote:
asandroq:
Hallo,

Andrew Coppin wrote:
C++ has some interesting ideas. I haven't learned how to use templates
yet, but what I do find interesting is that there is no automatic memory
management, and yet you can still do fairly dynamic programming. I've
never seen any other language that allows this. (I had assumed it's
impossible...) This makes me wonder just now necessary GC really is, and
whether there is some way to avoid it...

     Garbage collection was invented by Lisp implementors because of a
common pattern in functional languages: The sharing of parts of
structures, like lists. In an imperative world this is straightforward,
one allocates a linked list, uses it, and then releases the memory. In a

This is why memory management is a notoriously trivial problem in C++ ;)

-- Don (who thinks that complicated access patterns aren't unique to FP)
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe




_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to