On Wed, 28 Sep 2016 11:05 pm, Jussi Piitulainen wrote: > Steve D'Aprano writes: > >> On Wed, 28 Sep 2016 08:03 pm, Lawrence D’Oliveiro wrote: >> >>> On Wednesday, September 28, 2016 at 9:53:05 PM UTC+13, Gregory Ewing >>> wrote: >>>> Essentially you write the whole program in continuation- >>>> passing style, with a state object being passed down an >>>> infinite chain of function calls. >>> >>> Procedural programming under another name... >> >> Only in the sense that procedural programming is unstructured programming >> under another name. What is a procedure call but a disguised GOSUB, and >> what is GOSUB but a pair of GOTOs? > > Continuation-passing style is only GOTOs. Instead of returning to the > caller, procedures pass control to the continuation, together with the > values that the continuation is expecting from the procedure. > > I guess you can think of it as a way to disguise a GOSUB.
Really, if you think about it, both functional and procedural programming are exactly the same as programming in assembly language. Returning a value from a function pushes that value onto the function call stack, which is really just a disguised assembly MOV command. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list