Stackless 3.0 alpha 1 at blinding speed

Anton Vredegoor anton at vredegoor.doge.nl
Mon Apr 21 23:31:09 CEST 2003


Steven Taschuk <staschuk at telusplanet.net> wrote:

>Quoth Anton Vredegoor:
>> "A.M. Kuchling" <amk at amk.ca> wrote:
>> 
>> >http://mail.python.org/pipermail/python-dev/1999-July/000467.html
>> 
>> Thanks. It seems Tim is making a heroic effort to explain the new in
>> terms of the old. This necessarily must fail, but what other option is
>> there instead of rebuilding all terminology out of gotos?
>
>I am not sure it needs to fail, nor that it is a bad idea to
>"rebuild" everything out of gotos.

Please let's see what our forefather said about this, centuries ago
when the world was young and fresh:

<Tim>

CONTINUATIONS

Given the pedagogical structure so far, you're primed to view
continuations as an enhancement of coroutines. And that's exactly what
will get you nowhere <wink>. Continuations aren't more elaborate than
coroutines,they're simpler. Indeed, they're simpler than generators,
and even simpler than "a regular call"!  That's what makes them so
confusing at first: they're a different *basis* for *all* call-like
behavior.  Generators and coroutines are variations on what you
already know; continuations challenge your fundamental view of the
universe.

</Tim>

>From this I get the impression that continuations are not explainable
in terms of the other structures because they're simpler. Application
of common sense logic is sufficient to conclude that it's inefficent
to explain amoebae in terms of elephants. Maybe if two twin elephants
could be found that differ only one amoeba from each other there would
be a basis for such explorations but it would still demand the utmost
disciminative powers from the observers. Furthermore I politely refuse
the implication of generalizing my remarks beyond the scope of the
link under our scrutinization and also confirm that I have no
objections whatsoever to rebuilding terminology out of gotos save
perhaps that in modern Python it's possible to pop stacks anyway one
wants to, which might provide a better analogy for the low level
operations.

>One possible method for understanding continuations, for those
>with C (or similar language) experience:  Assume you have only one
>control flow construct, a conditional goto.  Show how if/else,
>loops, and function call/return can be implemented using
>conditional goto.  Then show how coroutines, generators, and
>backtracking can be implemented using it.  Notice especially your
>use of constructions which consist of "save state, goto there" and
>"goto there, restore state" combined in useful ways, for various
>values of "state".
>
>Having thus prepared the conceptual ground, *then* go read
>material on continuations.

Seems like sound advice. However, I would like to make one observation
to save this discussion from the morasses of technological epicycles.
These continuations might seem difficult and hard to understand for
most people (including me, being on the wrong side of enlightenment in
this matter), however in years even longer ago when there were no such
sophisticated counting mechanisms as today are provided for even young
children, it was deemed a sign of superior intelligence to even be
able to divide two large integer numbers. The differance is the
conceptual framework and computer equipment that were absent then and
that are present now to fit the problem space in. I believe similar
advances in the concepts of continuations brought about by our
conceptual forerunners will enable the masses in the end to follow and
come to grips with the matter at hand. Therefore it is advisable to
refrain from esoteric behavior around these -expected to become so
RSN- probably relatively simple concepts.

Anton





More information about the Python-list mailing list