On Fri, 2008-06-20 at 10:50 -0500, Larry Garfield wrote:
> 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?

I like that, and also like the parenthesis on both parameter listings
for greater readability. In a related question, would the following be a
natural extension?

$myfun = lambda($a, $b, &$c) lexical ($d, &$e) global ($f, &$g){
    // ...
}

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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

Reply via email to