Closures
RealyUniqueName opened this issue · comments
Haxe
var notUsedInClosure = 123;
var used = "world";
return function () {
this.hello(used);
}
PHP
$notUsedInClosure = 123;
$used = "world";
return function () use (&$used) {
$this->hello($used);
};
Anonymous functions
Support of this
in closures requires at least PHP 5.4.
This is one of the biggest weaknesses of the old genphp.. Except for passing local vars this should be straightforward, no?
PHP 5.4 is no problem, I'd say. 5.5 is the oldes supported version ATM.
Yes, the only problem is collecting vars available in current scope.
There should be code for this in old genphp (as you probably know). The old closure generation needs this as well.