Fun factβjust yesterday I had an issue with some code that was blowing the stack. I rewrote it to use CPS, and it turned out that I actually had infinite recursion, so I had the great privilege of blowing the heap instead π
Why is CPS transformation (continuation passing style) useful? Because it turns general recursion into tail recursion, which the compiler can easily transform into a goto. Consider this very simple tree:
Grain v0.5 "Durum" is here! Faster compile times, more efficient binaries, a brand new language server, better pattern matching, bigints, and more in this absolutely packed release πππΎ
grain-lang.org/blog/2022/06/0β¦