Skip to content

Instantly share code, notes, and snippets.

@cotto
Created April 9, 2011 00:11
Show Gist options
  • Save cotto/910962 to your computer and use it in GitHub Desktop.
Save cotto/910962 to your computer and use it in GitHub Desktop.
=head2 Continuation-Passing Style in M0
=head3 CPS Basics
CPS, in the simplest possible terms, means that no function ever returns to its
caller. Instead of returning, a function invokes a continuation passed to it
as one of its arguments.
better intro: L<http://matt.might.net/articles/by-example-continuation-passing-style/>
=head3 Implementation
Note: this section is more a brain dump than an implementable spec. Nothing in
here should be taken more seriously than the rantings of a deranged hobo.
stuff in the vartable gets inherited by child contexts
register values get passed unmodified and should follow recommended calling conventions
calling conventions need to be defined
all this should be as simple as possible. implementing cow might be a bit much for an m0 implementation
q; what's a sane way to determine which variables are and aren't cow'd? there can be a lot of them
q; I shouldn't dictate mechanism as much as policy. I can say "vartables are inherited", but cow is an implementation detail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment