3 ms·
It only gets interesting to me when browsers (or for that matter node) get tail-call optimization. Until then iteration makes way more sense than recursion in
by chessturk 8y ago
It only gets interesting to me when browsers (or for that matter node) get tail-call optimization.
Until then iteration makes way more sense than recursion in JS.
- vimslayer 8y agoI don't quite understand what that has to do with the parent commenter's language suggestions. Simple TCO is easy to implement in the compiler level. ReasonML, for example, is quite capable of optimizing the usual recursive fibonacci example into a while loop [1]. [1]: https://reasonml.github.io/en/try.html?rrjsx=true&reason=DYUwLgBATiDGEDMCWAjCBeCAKAdgGggGcBXAWwIAcYA3ASgwD4AoCCHCAHkwEYWIB+ImT4AuRKlwQAtBG6UaEANRDyK2gG4mTAFKEAdMAD2AcyzIUWAGwAGawTuzaGoA https://reasonml.github.io/en/try.html?rrjsx=true&reason=DYU...