>   * I added tests (Zend/tests/closures_*.phpt) that ensure the correct
>     behaviour of closures.

I'd like to propose an additional test to ensure closures can all themselves:
<?php
$i = 3;

$lambda = function ($lambda) use ($i) {
    if ($i==0) return;
    echo $i--."\n";
    $lambda($lambda);
};

$lambda($lambda);
echo "$i\n";
?>
Expected output:
3
2
1
3

I see exactly one problem with the patch, which is that the above script 
shouldn't work without "use (&$i)".
I find it counterintuitive that the creation of the lambda creates a copy of 
$i, but all invocations of $lambda use a reference to the same $i.
For n calls to $lambda, there are only 2 copies of $i (one global, one static 
in $lambda) where I would expect n+1 copies.

Gesundheit
  Wag

-- 
Sieh dich, nimm Sorge.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to