Hacker News new | past | comments | ask | show | jobs | submit
Maybe I'm dumb but how can a proper language work without heap and only use stack memory, stack only works if you know the size you want before compiling, or am I wrong ?
A stack can grow arbitrarily deep (in practice, assuming 64-bit address space), but it grows only in one dimension. However, you can also have arbitrarily many stacks, so you can have a separate stack for every single thing that can grow in size in your program (by statically analyzing what variables hold data structures that could grow, and how many stacks at most you will need at the peak when program runs).