Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Some languages on the jvm (namely scala) do have tail call recursion, meaning that in many cases recursion can use constant stack space


I thought you had to manually mark the method (and/or the recur site) for scala to do tail call optimisations.


It does the optimization by default, the annotation is to ensure it raises a compilation error if it actually fails to optimize.


Indeed, and it should be noted that it's quite limited in when it can actually apply the optimization, i.e. self-recursion only (I believe).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: