3 ms·
cough I hereby propose two new language constructs and corresponding keywords, which can be applied (sounds more functional than implemented,) widely across man
by fuzztester 2y ago
cough I hereby propose two new language constructs and corresponding keywords, which can be applied (sounds more functional than implemented,) widely across many languages, at least procedural / imperative ones:
goto and comefrom
with optional synonyms:
leave to and return from
the above can be shortened to as little as two letters each:
go and co
le and re
for fans of succinctness / conciseness.
PRs are open.
- fc417fc802 2y ago> with optional synonyms Leave I follow, but doesn't "return from" rightly describe a continuation as opposed to "come from" which is a nonlocal goto?
- fuzztester 2y agoI stopped understanding continuations before I even started.
- fc417fc802 2y agoI can't quite tell if you're serious. Continuations are fun, so I'll post this on the off chance it helps someone. They are perplexing until they aren't. Model stack frames as independent state. When you return from a function the stack frame can stick around. Now later, place your stack pointer back in the frame that you returned from earlier. Add a convention for passing arguments when you update the stack pointer as above. Now you have continuations.
- bryanrasmussen 2y agoso you can place your stack pointer back in the frame that you returned from earlier? that's probably the point at which they stopped understanding continuations before even starting.
- cyco130 2y agoThat’s the tricky part. There’s no stack anymore. Activation records of functions are heap-allocated and can stick around as long as necessary.
- fc417fc802 2y agoTo be fair it's still a stack (the data structure). It just isn't contiguous in memory anymore. Of course modern LLVM already breaks it up into chunks anyway (given certain flags at least) so it likely isn't contiguous regardless.
- bryanrasmussen 2y agoI was explaining the joke? Since the person I was replying to seemed to wonder if it was really a joke, whereas for me, structurally it was obviously a joke.