|
|
|
|
|
by coroutines
3703 days ago
|
|
I would really be interested to know why we need a special syntax for tail calls. (genuinely curious) I'm from Lua originally and we've had tail calls forever... why would you point them out? It should be obvious: return wat() |
|
With implicit tail call elimination, those stack traces will change in non-trivial ways that could affect debugging processes or break existing tools.
I've also heard some concerns about implementation difficulties, but I know at least one major engine has implemented PTC as specified in ES2015 without issue. I think (and hope) these concerns are secondary to the discussion about stack traces and backwards compatibility.
tl;dr: as with almost every "why is it like that" question about JavaScript, the answer is "because backwards compatibility".
(I also started with Lua and have adjusted to JS over the years; they have more in common than many people realize!)