3 ms·
If we're fixing the language, may as well fix the real problem and not artificially limit stack space.
by cobbal 1y ago
If we're fixing the language, may as well fix the real problem and not artificially limit stack space.
- Retr0id 1y agoThe language doesn't get much of a say, stack limits are usually inherited from the OS itself. It's fixable by not using the OS-provided stack but that's a much more invasive change than a new syntax/stdlib feature.
- worthless-trash 1y agoThe compiler/language absolutely gets a say in this, you can do tail call recursion without stack saturation.
- Retr0id 1y agoTail call elimination is an optimisation that is only possible for certain code patterns. How would you write a tail-recursive tree walk, without using a separate stack or queue data structure to store state?
- worthless-trash 1y agoChallenge accepted, I'll do it over my next long weekend.