Re: PATCH: anonymous functions in PHP
| From: | Robert Cummings | Date: | Mon, 19 Mar 2007 23:03:15 +0000 |
| Subject: | Re: PATCH: anonymous functions in PHP | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-28470@lists.php.net to get a copy of this message | ||
On Mon, 2007-03-19 at 17:53 -0400, Sean Coates wrote:
> > I'm not arguing the preservation of the exact value of $rev when the
> > anonymous function was created (as would be the case with a closure).
> > I'm thinking of the variable being whatever is defined in the parent
> > regardless. As in my proposal, the seek could search all the way up to
> > the top in which case the $rev would be found if it had been defined as
> > expected. At any rate, I guess this is diverging from the real
> > discussion of anonymous functions :)
>
> If you've ever tried to hack on the source to anything that you didn't
> write that also uses globals throughout (Gallery2, for example), you
> know how hard it is to track down a single layer of scope that can be
> defined [somewhere else].
>
> Tracking this up the chain like a bubbled exception sounds like a
> nightmare for debugging/comprehension, and IMO it's too magical.
>
> One layer of scope might be useful: $_PARENT ?
> More than that, and my head starts to hurt.
Well I did originally suggest defaulting to the parent scope with
options for advanced users to climb higher :) Just because there are
unwashed masses as Richard Lynch likes to call it, doesn't mean we all
need to suffer their limitations.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'