3 ms·
Or you could avoid (semantically) having a stack at all, as Haskell does.
by lmm 6y ago
Or you could avoid (semantically) having a stack at all, as Haskell does.
- bjoli 6y agoI don't see how that could be done... Is it a result of laziness?
- jlouis 6y agoYou just push the stack into the heap, and don't have a specific area which is the stack area. It's pretty common as a technique if you have something such as call-with-current-continuation. The "stack" is still there in this case, but spread out over multiple heap blocks.
- bjoli 6y agoGuie Scheme does something similar then. It expands the call stack so that you can't have a stack overflow. Pretty neat since it allows you to write recursive functions without accumulators. I suspect something like that is a bigger deal in eagerly evaluated languages.