Hacker News new | ask | show | jobs
by gavinray 1543 days ago
The Koka research language has something it calls "FBIP" (Functional, but in-place)

Where you write functional/immutable methods and the compiler deterministically can convert it to in-place mutating operations for performance:

https://koka-lang.github.io/koka/doc/book.html#sec-fbip

  "With Perceus reuse analysis we can write algorithms that dynamically adapt to use in-place mutation when possible (and use copying when used persistently). Importantly, you can rely on this optimization happening, e.g. see the match patterns and pair them to same-sized constructors in each branch."

  "This style of programming leads to a new paradigm that we call FBIP: “functional but in place”. Just like tail-call optimization lets us describe loops in terms of regular function calls, reuse analysis lets us describe in-place mutating imperative algorithms in a purely functional way (and get persistence as well)."