Created
November 3, 2011 20:28
-
-
Save mendelgusmao/1337691 to your computer and use it in GitHub Desktop.
Passing a closure from front end to back end (just a dream)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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