Skip to content

Comment on Can functional programming be liberated from the von Neumann paradigm? (2010)parent

Comments

A pure function cannot always be executed in parallel. For that it might need access to shared data. On non-von Neumann machines this may not be possible.

Wouldn't such a function not be pure? Or am I not understanding the notion of purity?

Of course it can be pure, so long as the shared data is not mutated. Functional languages such as Haskell don't copy values all over the place when calling functions, they pass in pointers.

But that's an optimisation. Which can be switched off to get the benefits from parallelism. This is a tradeoff that programmers would traditionally have to consider, but with functional programming the compiler can figure it out for us.

That's assuming that "figuring it out for us" is decidable. Many of the things we wish the compiler could do for us are not.

"It's not decidable" is not a guarantee that humans can do better than a compiler. It means any approach will sometimes be wrong, but a compiler might well (in principle) be wrong less often than a human.

This is separate from the "a human has a lot of additional context that's hard to express" argument, which is valid but has nothing to do with decidability.

A pure function cannot always be executed in parallel.

Try doing that to eg calculating chained hashes.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.