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

Re: A plea for a new old language

After talking to one of my compiler-guru friends, I found out that,
amazingly enough, you *can* do CPS in C, even without first-class
functions.  You have to lift the internal lambda expressions to the top
level and name them, and have an extra argument representing the state
captured by the lambda, yadda yadda, but it's doable.  I guess Real
Programmers can write scheme in any language ;-)


> Date: Fri, 9 May 2003 09:17:51 -0400
> From: Dan Sugalski <dan@sidhe.org>
> At 3:13 PM -0700 5/8/03, Michael Vanier wrote:
> >Maybe I'm missing something, but I don't see how to do CPS in C.
> >How do you create the continuation inside a function?
> I'm not doing CPS for C code--there's a limit to how nuts I care to be. :)
> Rather, the CPS stuff I'm considering is at the VM level, where the 
> VM's transfer-of-control uses a form of CPS. So the C code is just C 
> code, but the sequence of VM instructions a compiler emits does the 
> CPS thing. I'm working on more details, and I'm getting more and more 
> convinced as I do this that CPS is the right way to go, suitably 
> cloaked with a good soft sell for folks.
> >  > Date: Thu, 8 May 2003 11:27:31 -0400 (EDT)
> >>  From: "Kevin Kelleher" <kkell@znet.com>
> >>
> >>  Dan,
> >>
> >>  The material on the Parrot website is quite interesting.
> >>  I don't think that CPS would be hard to justify:  you
> >>  could probably get away with saying that it would make
> >>  Parrot able to handle a wider variety of languages
> >>  and programming styles.
> >>
> >>  Since you're using C, could you simply prepare a template
> >>  or templates for coders who know not CPS?  Maybe
> >>  "template" is not the right word; what I mean is
> >>  files that have the CPS stuff in place and comments
> >  > like  /*** YOUR CODE GOES HERE ***/
> -- 
>                                          Dan
> --------------------------------------"it's like this"-------------------
> Dan Sugalski                          even samurai
> dan@sidhe.org                         have teddy bears and even
>                                        teddy bears get drunk