On Friday 20 June 2008, Chris Stockton wrote:
> No one at all thinks:
> function foo($x, $y) use $a, $b, $c {
> }
>
> Looks awkward and a little out of place

It certainly is new and different in PHP, but I don't see a reason why this 
should be hard to get used to.
Also, it works for Java exceptions.

void foo () 
   throws IOException { 
}

> we should at least import into the scope in a way consistent with how we do
> it already with GLOBAL right? Just seems a lot cleaner IMO.

At first I also thought that it would be nice to be consistent with global. 
Then I realized that global is inconsistent with everything else in PHP (by 
using references instead of copies by default), which is probably why it's 
use is discouraged in favor of $GLOBALS.

I think it makes much more sense to make lexically (and globally) scoped 
variables look like declared exceptions in Java and make them part of the 
interface of the function, than to make them look like local variable 
declarations in C.
Why allow the declaration of a reference to a global or lexical variable in 
the middle of a loop?

Gesundheit
  Wag

-- 
One hundred little bugs in the code
One hundred little bugs.
Fix a bug, link the fix in,
One hundred little bugs in the code.

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

Reply via email to