Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Yield Passing Style

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 node_modules
Octocat-spinner-32 Makefile
Octocat-spinner-32 README
Octocat-spinner-32 index.html
Octocat-spinner-32 machine.js
Octocat-spinner-32 test-output.js
Octocat-spinner-32 test.js
Octocat-spinner-32 yps.js
It seems to me that you can implement a much simpler CPS in javascript using the new `yield` operator... This would also work really well with promises, completely eliminating callback hell in one simple step... It also easily integrates into non-CPS code. If this is true, I think I just found something awesome.

I call this technique "Yield Passing Style", as it abuses `yield` to generate individual frames that are controlled with an explicit stack manager, giving me control over the stack and execution.

NOTE: Ok, so I implemented this and go it working, but it's too slow for any real world use. Seems like it kills the JIT. Still interesting though!

Copyright (c) James Long 2012 and YPS is trademarked so I'll tweet mean things to you if you steal it.
Something went wrong with that request. Please try again.