On Fri, 20 Jun 2008 16:33:08 +0200, Alexander Wagner <[EMAIL PROTECTED]> wrote:
> On Friday 20 June 2008, Larry Garfield wrote:
>> > function ($x, $y) use ($a, $b, &$c) {};
>>
>> I am not sure if "use" is the clearest word to use there (wouldn't
> lexical
>> there make more sense?)
> 
> I agree. "use" for both namespaces and closures may not be a good idea.
> Otherwise +1 to this syntax for its low WTF-factor.
> Look like parameters. Behave like parameters.
> 
> Also, allowing this for regular function definitions might be a nice
> long-term
> replacement for global.

Totally silly idea:

function foo($a, $b, &$c) global ($d, &$e) {
  // ...
}

$myfunc = lambda($a, $b, &$c) lexical ($d, &$e) {
  // ...
}

That puts all the information in the declaration line with parallel syntax and 
semantics, and would even allow both by-val and by-ref usage for both lexical 
and global values.  The following would then be exactly equivalent 
functionality-wise:

function foo() global (&$a) {
  // ...
}

function foo() {
  global $a;
  // ...
}

Is that too crazy an idea?

--Larry Garfield


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

Reply via email to