[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CPS in Parrot (was: A plea for a new old language)

At 4:52 PM -0700 8/5/03, Michael Vanier wrote:
>I think the difficulty with continuations is even more basic than you
>describe.  Continuations used in the call/cc sense violate our most basic
>assumption about functions, which is that a function called from HERE is
>going to return back HERE (the same place).  Continuations let you say: a
>function called from HERE is going to return back WHEREVER, where WHEREVER
>is some location in the code that was previously captured in the
>continuation, lexicals and all.  This idea that you can control where a
>function call is going to return is tremendously powerful, but is also very
>tough to wrap your mind around (I still don't feel I fully get it).

That confusion really comes about if you think of continuations as 
function calls. They really aren't, as such--while you can implement 
function calls with them, in languages that have function calls and 
continuations I think keeping them separate leads to less confusion.

>  > Date: Tue, 5 Aug 2003 18:10:14 -0400
>>  From: Dan Sugalski <dan@sidhe.org>
>>  At 3:22 PM -0400 8/5/03, Geoffrey Knauth wrote:
>>  >On Tuesday, Aug 5, 2003, at 13:00 US/Eastern, Dan Sugalski wrote:
>>  >>I'm convinced at this point that all of the fear people have about
>>  >>continuations is a direct result of how they're taught and what's
>>  >>associated with them
>>  >
>>  >I haven't feared what I don't know.  I'm afraid to ask, "What's
>>  >associated with them?"
>>  Lisp and/or Scheme, though the way the design of computer languages
>>  is taught (or, rather, not taught, until far too late) doesn't help.
>>  The only place continuations are brought up, assuming they're dealt
>>  with at all, is in a Lisp class, but not until the students have
>>  already had a number of years (upwards of 5-10 for some) of
>>  procedural and/or OO programming (C, C++, VB, even Java to some
>>  extent), which hammers some assumptions about the intrinsic
>>  stack-based nature of control-flow into students heads.
>>  So, they walk into a lisp class with either the C model or the BASIC
>>  "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 end up with a class full of people that either dislike
>>  continuations because they clash with what they know to be true about
>>  control and/or variables, or dislike continuations because lisp
>>  clashes with what they know and any concepts introduced with it get
>>  disliked by association. (Or they never understood it in the first
>>  place because they couldn't get past the confusion of dealing with a
>>  functional language, so everything explained in terms of the language
>>  didn't stick)
>>  It doesn't help that many of the folks publicly advocating
>>  continuations tend to be a little... odd, so when you do run across a
>>  paper or proposal, your first impression is that the author's either
>>  mad or doing the CS equivalent of particle physics.
>>  Not true for everyone, certainly -- a lot of people never get taught
>>  anything about continuations, and all they know about them is that
>>  most folks think they're Deep Black Magic.
>>  --
>>                                           Dan
>>  --------------------------------------"it's like this"-------------------
>>  Dan Sugalski                          even samurai
>>  dan@sidhe.org                         have teddy bears and even
>>                                         teddy bears get drunk


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                       teddy bears get drunk