← Back to context

Comment by ergeysay

1 year ago

Not to mention that pure FP completely handwaves away implicit global state such as heap.

That's the point. This hand waving allows the user to build more complex systems.

The cost is efficiency but make no mistake not thinking about the heap allows people to build much more complex programs. It's a trade off between complexity and efficiency.

  • Then could it reversely be argued that not worrying about the stack (tail recursion) allows people to build more complex programs? Probably depends on which is more worrisome on average, heap or stack.

  • Au contraire. It is a tradeoff between application programmer effort and compiler writer effort. Amortization infers it is better to have an extremely advanced IR optimizer.

    • Then why do zero cost abstractions exist? Languages like rust and C++ make the trade off on the application side rather then the compiler side.