4 ms·
GOTO-based programming is just continuation passing style - the definition of GOTO is literally switching the continuation of the current statement to something
by zozbot234 3y ago
GOTO-based programming is just continuation passing style - the definition of GOTO is literally switching the continuation of the current statement to something else. (Which means that its preconditions are OR'd to the preconditions of its target statement, and its post-condition is not defined. A GOTO-based program becomes easier to analyze and understand if you add COME-FROM markings to every possible GOTO target.) Incidentally, one can understand self-modifying code in a similar way.
- ddingus 3y agoI second the request to expand. I do not understand your comment and I want to. Got a link we can use to get some insight maybe?
- rafavento 3y agoI find this intriguing. Would you mind to expand?
- goto11 3y agoGOTO does not pass a continuation though, so I can't see how it is similar to continuation-passing style. GOTO is just a jump like jumps in machine code. BASIC does not have notion of a continuation as a value.
- zozbot234 3y agoSome BASICs such as BBC BASIC allowed GOTO to take a variable or expression directly, and many BASICs supported the ON..GOTO construct that allows for the same. And turning all control flow within a program into jump-like operations is arguably the main point of CPS.
- goto11 3y agoBut this is just computed gotos. There is no continuation passed. Arguably the main point of continuation-passing style is that you pass a continuation along with the jump. Hence the name.