Pinned post
This is exactly what Reverse Polish LISP is. I coded exclusively in RPL in my formative years because the only programmable device available to me was a second hand stolen HP 48SX calculator. My father was able to buy it for $10 because it came with no manuals. The guy selling it was frustrated because even doing just 2+2 resulted in error message.
It took me a full week to figure out how everything actually worked. Eventually I wrote all kind of multi-thousand line programs including even video games! But all of that time I had no idea what was the name of the programming language I was coding in. I'd figured out its syntax only by trial and error.
It was painful using that little keyboard to write thousand line programs. Of course there was no storage device so if internal memory gets full, you delete code and later re-type whole thing all over again to "reload" it.
So I might be the only person alive who coded in language without knowing its name or official syntax 😅.
In any case, I still consider RPL to be one of the most beautiful language I ever coded in. There are no traditional memory allocations. You just put everything on stack. There is no distinction between functions and data so function definitions also go on stack. You use various stack manipulation operators (which themselves can be on stack). It was beautiful.
It took me a full week to figure out how everything actually worked. Eventually I wrote all kind of multi-thousand line programs including even video games! But all of that time I had no idea what was the name of the programming language I was coding in. I'd figured out its syntax only by trial and error.
It was painful using that little keyboard to write thousand line programs. Of course there was no storage device so if internal memory gets full, you delete code and later re-type whole thing all over again to "reload" it.
So I might be the only person alive who coded in language without knowing its name or official syntax 😅.
In any case, I still consider RPL to be one of the most beautiful language I ever coded in. There are no traditional memory allocations. You just put everything on stack. There is no distinction between functions and data so function definitions also go on stack. You use various stack manipulation operators (which themselves can be on stack). It was beautiful.
I always thought it was a shame that modest default stack setups made alloca() a generally-frowned-upon technique in C/C++. With 64 bit architectures, give every stack a virtual address space equal to the physical memory by default!View quoted post on X
You can do a surprisingly good job of memory management with just the stack, and I contend that it has both correctness and performance advantages.
Allocations are a trivial pointer adjustment, and frees are literally free. Keeping everything linearly packed is friendlier for all layers of the cache hierarchy, and it makes keeping everything in huge / gigantic pages easy.
Leaving temporary intermediate blocks on the stack can seem wasteful, but unless you are dealing with algorithms that make > O(n) temporary allocations, it is usually not a big deal.
Static analysis can check if you store a stack pointer into a structure deeper in the stack, which is a use-after-free, and then memory management correctness is guaranteed.
The discipline of caller-allocates-return is awkward in some dynamic cases. It would take a change in low level calling conventions, but you could plausibly have functions that return with the stack extended from where it was when they were called. I’m not holding my breath for that.
It isn’t obvious if having AI coding agents makes discussions of software architecture more or less important!