2 ms·
Without having a way to tell the compiler to fail if it can't TCO (f# finally got this with a function attribute in 8.0), teaching tail calls first is only goin
by runevault 2y ago
Without having a way to tell the compiler to fail if it can't TCO (f# finally got this with a function attribute in 8.0), teaching tail calls first is only going to lead to problems because screwing them up to pile up on the stack is likely when you don't know what you're doing.
- nequo 2y agoOCaml[1] and Scala[2] have had this too. [1] https://batsov.com/articles/2024/01/16/learning-ocaml-verifying-tail-recursion-with-tailcall/ https://batsov.com/articles/2024/01/16/learning-ocaml-verify... [2] https://www.scala-lang.org/api/current/scala/annotation/tailrec.html https://www.scala-lang.org/api/current/scala/annotation/tail...
- runevault 2y agoI was pretty sure OCaml had it but I'm less than a newbie with it (touched dune a little bit and built tiny apps but nothing real) so didn't want to bring up something I wasn't sure about. And Scala I haven't looked at in like a decade, but thinking about it I am not surprised it has similar protections. I feel like Clojure also had a keyword to recur as tail but probably been 12 years since I used that language so my memory could be completely faulty