[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CPS in Parrot (was: A plea for a new old language)
> > > "They're all globals!" model deeply internalized, then get hit in
> > > rapid succession by Lisp's very different paradigm then a control
> > > flow and variable model completely at odds with what they know to be
> > > true.
> > You then show them setjmp/longjmp -- when they gag you Hop, Skip and Jump
> > over to chapter 13 of _The Seasoned Schemer_ for a beautiful introduction.
> You can't longjump back into a function that's already exited. You can
> call a continuation to re-enter code that has
> terminated. Exceptions/non-local *exits* are commonly understood, but
> full continuations are very unusual to most people.
Indeed they are different. It has not been my experience that non-local
exits ala longjmp are commonly understood by C-style programmers.
Certainly not in the vocab of most new C++/Java programmers.
It has been my experience that when students first learn about exceptions
in a 1st/2nd semester course they treat their implementation as a black
box. Students can learn to use continuations in the same fashion, but
continuations are often taught in the context of their implementation or
more challenging topics.
It terms of /implementation/, if you're comfortable with the idea of
saving and restoring the stack then heap allocation of stacks is not too
hard to understand. In terms of /usage/ _The Seasoned Schemer_ makes it
pretty easy to get comfortable programming with continuations without
going into how they are implemented.