3 ms·
I don't feel like this is quite the right way to look at it. Computers don't have stacks and heaps, software has stacks and heaps. Of course, in recent times th
by taneq 3y ago
I don't feel like this is quite the right way to look at it. Computers don't have stacks and heaps, software has stacks and heaps. Of course, in recent times there are built-in CPU instructions that do memory management and whatnot, but that's not the point. Give a programmer a Turing-complete machine and enough time to play with it and, while elegance and efficiency will vary with the underlying architecture, they (on that machine) will have stacks, heaps, and any other computable thing they wanted.
I first learned to program on a calculator in a kneecapped version of BASIC which didn't support recursion, function calls, user defined variables (you got 'A' to 'Z' and that was all) or dynamic memory management (other than resizing 'matrices' and 'lists' iirc). I wanted to write Minesweeper on it and to do so I independently invented what I later found out were well know as depth first search and breadth first search, using just some loops and a list as a stack. (I was a kid and we didn't really have the internet yet. :P )