Re:Misconceptions about loops in C
by runevault on Thursday June 27, 2024 @03:13PM
(#40813963)
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.
[ Parent
| on HN ]
OCaml[1] and Scala[2] have had this too.
[1] https://batsov.com/articles/2024/01/16/learning-ocaml-verify...
[2] https://www.scala-lang.org/api/current/scala/annotation/tail...
I 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