That's one of the motivations for the patch. I never liked the new syntax, but if it was given a go, it should also be made consistent with the another part of the syntax. Oh, I just got one important thing in mind to mention;

test1.php:
<?php
function a() {
    $a = "bar";
    include("test2.php");
}

$a = "foo";
a();
b();
?>

test2.php:
<?php
function b() use ($a) {
    echo $a, "\n";
}
b();
?>

running test1.php ends up with two lines of "bar", surprisingly. This is somewhat confusing, but surely one of the things that could not ever be done. This might be a great help when you use a PHP-script file as a mark-up template.

Moriyoshi


On 2008/07/18, at 15:10, Larry Garfield wrote:

Which is why I am not a fan of this syntax as proposed. You're using the same
keyword to mean two different but very very close things.  That's very
confusing.  It also means that you cannot take a global by value in a
closure.

Earlier the following was proposed:

function foo($a, &$b) global ($c, &$d) {

}

$bar = new function($a, &$b) use ($c, &$d) global ($e, &$f) {

};

Which I think is much more self-explanatory, accomplishes the same goal, and still does not introduce any new keywords. (I still think "lexical" is
better than "use", and safe, but whatev. <g>)

--
Larry Garfield
[EMAIL PROTECTED]

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




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

Reply via email to