Manual memory allocation and purity

Posted by Eonil on Programmers See other posts from Programmers or by Eonil
Published on 2012-04-09T03:32:12Z Indexed on 2012/04/09 5:45 UTC
Read the original article Hit count: 237

Filed under:
|

Language like Haskell have concept of purity. In pure function, I can't mutate any state globally. Anyway Haskell fully abstracts memory management, so memory allocation is not a problem here.

But if languages can handle memory directly like C++, it's very ambiguous to me. In these languages, memory allocation makes visible mutation. But if I treat making new object as impure action, actually, almost nothing can be pure. So purity concept becomes almost useless.

How should I handle purity in languages have memory as visible global object?

© Programmers or respective owner

Related posts about memory

Related posts about purity