Closed francescoagati closed 12 years ago
this pull request add support for php 5.3 closure with this form:
(def x 100) (def y 100) (def sum (plambda (a b) (+ a b x y))) (def sum3 (plambda (a b) (+ a b)))
a closure is callable in this form (like variable string that is referred to a function): ($sum 1 2)
($sum 1 2)
bind of variables inside the closure is made from pharen scope so this form
(def x 100) (def y 100) (def sum (plambda (a b) (+ a b x y)))
is compiled in php
$__scope_id = Lexical::init_closure("plambda", 129); $x = 100; Lexical::bind_lexing("plambda", 129, '$x', $x); $y = 100; Lexical::bind_lexing("plambda", 129, '$y', $y); $sum = function ($a, $b){ $x = Lexical::get_lexical_binding('plambda', 129, '$x', isset($__closure_id)?$__closure_id:0);; $y = Lexical::get_lexical_binding('plambda', 129, '$y', isset($__closure_id)?$__closure_id:0);; return ($a + $b + $x + $y); }
i close this pull request for now there is a bug in return plamba from another function
this pull request add support for php 5.3 closure with this form:
a closure is callable in this form (like variable string that is referred to a function):
($sum 1 2)
bind of variables inside the closure is made from pharen scope so this form
is compiled in php