Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created January 15, 2012 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save isaacs/1613485 to your computer and use it in GitHub Desktop.
Save isaacs/1613485 to your computer and use it in GitHub Desktop.
// block-lambda proponents: what does this program do?
function omgnomakeitstopkillitwithfire (t) {
x = {|y|
return "returning: " + y
}
// now here comes a bunch of code.
// imagine there are 50 lines here
t(x)
// now a bunch more stuff.
// eventually:
x("there")
// then a bunch more stuff
// ending with:
return 100
}
var ret = omgnomakeitstopkillitwithfire(function (cb) {
alert("before")
cb("here")
alert("after")
})
alert(ret)
/**
* HOW DOES THIS NOT QUALIFY AS INSANE ACTION-AT-A-DISTANCE???
* Seriously, this belongs in the bad-parts bucket with `with` and `eval`.
**/
@grncdr
Copy link

grncdr commented Jan 18, 2012

@BrendanEich, much better example of used mixed returns, I retract my previous suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment