News for hackers. Stuff that matters.
Re:Stack safety for free? by servytor on Monday December 06, 2021 @11:57AM (#29462252)
But Clojure uses 'recur' because you cannot modify the stack in the JVM (at least to my knowledge that is the issue with the JVM and TCO).
Re:Stack safety for free? by runevault on Monday December 06, 2021 @01:40PM (#29463785)
Right and it uses a trampoline under the hood.
Re:Stack safety for free? by pflanze on Tuesday December 07, 2021 @02:23PM (#29477028)
Since "recur" only allows to recurse to the closest recursion point (a loop or the enclosing function definition), what if it just used JVM's "goto"? Or, if the JVM didn't have a goto, but any kind of iteration construct, used that instead? Then it doesn't have to use a custom stack or allocate anything on the heap.