3 ms·
The problem that’s hard to get around is this: https://github.com/elixir-lang/elixir/issues/6357 https://github.com/elixir-lang/elixir/issues/6357 Tail calls
by foldr 4y ago
The problem that’s hard to get around is this:
https://github.com/elixir-lang/elixir/issues/6357 https://github.com/elixir-lang/elixir/issues/6357
Tail calls don’t have to be recursive. See also this old thread:
https://news.ycombinator.com/item?id=5376924 https://news.ycombinator.com/item?id=5376924
- ynniv 4y agoGood point, but surely there's a compromise somewhere. Keep the first TCO'd frame for reference maybe? Perfect stack traces aren't required.
- foldr 4y agoYeah, that could work in principle. However, if it's a language that’s using recursion for looping, then you'll loose that history every time you have a loop with more than n iterations (which could be quite often). Given that recursion can be indirect, you can't entirely eliminate that problem just by special casing direct recursion. It might still be better than nothing, though, I agree.