Skip to content

Instantly share code, notes, and snippets.

@mendelgusmao
Created November 3, 2011 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mendelgusmao/1337691 to your computer and use it in GitHub Desktop.
Save mendelgusmao/1337691 to your computer and use it in GitHub Desktop.
Passing a closure from front end to back end (just a dream)
A Closure object doesn't have a way to return its code as a string (i.e., like JavaScript has), so, it won't work.
@ front end (PHP >= 5.3):
$calls = new ClosureCall(
function ($a, $b) { return $a + $b; },
array(1, 2),
"var_dump"
);
// Note: no back end specified!
$ipc = new GhettoIPC(new FileDriver, null, $calls);
Implications:
How to execute the back end without a file in back end?
GhettoIPC would detect the existence of ClosureCalls in the queue and add a piece of code instantiating GhettoIPC and invoking its execute() method? (ugly: using '-r')
What if there are any Call/StaticCall/ObjectCall objects in the queue?
Variables in 'use'...
(...)
;)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment