On Dec 18, 2007 12:41 AM, Jeff Moore <[EMAIL PROTECTED]> wrote:
> Reading the prior discussion, I think either $_SCOPE['x'] or the
> lexical $x syntax is fine for accessing local variables in the
> enclosing scope.   But closures also should also support $this and
> static:: when the closure is defined in a method.

While I realise that the possibilities of static scope in PHP, are
intriguing, I really think it's a whole different discussion. Related,
yes. Interesting, yes. But let's keep it separate, to avoid derailing
the whole discussion.

On Dec 17, 2007 8:46 PM, Stanislav Malyshev <[EMAIL PROTECTED]> wrote:
> While we are at it, what's wrong with knowing the name? I can see why
> closure can be fun when you can dynamically use outer-scope variables.
> But when you can't, what exactly prevents one from just doing the function?

If the code block, which needs to create the function, could be run
more than once, it would try to define the function twice, leading to
a fatal error. Yes, I could guard it with is_function_defined(), but
that wouldn't be pretty. Technically speaking, you're right, but I
think aesthetics does have some weight. Or should. It's also my main
gripe against create_function() in the first place.

On Dec 17, 2007 8:46 PM, Stanislav Malyshev <[EMAIL PROTECTED]> wrote:
> First, about 100% on the first encounter for any user ever seeing
> closures in any other language. Second, all the confusion possible, like

So how big a part of PHP's userbase is that? I'm guessing, it's small.

On Dec 17, 2007 8:46 PM, Stanislav Malyshev <[EMAIL PROTECTED]> wrote:
> closures in any other language. Second, all the confusion possible, like
> "oh, closures! cool! let me do this and that! what, I can't use
> variables?! Are you kidding me?! WTF is it useful for?!"

True, but the people who will anguish over lack of closures, are
already tearing their hair out over create_function().

On Dec 17, 2007 8:46 PM, Stanislav Malyshev <[EMAIL PROTECTED]> wrote:
> I'm not sure I understand what you mean by "static scope" and "dynamic
> scope", ...

Static scope is a synonym for lexical scope.

On Dec 17, 2007 8:46 PM, Stanislav Malyshev <[EMAIL PROTECTED]> wrote:
> scope", but anyway thing that looks like closure but works like regular
> function definition that isn't - is not a very good idea, IMO.

Yes, that's the primary problem with the patch. I don't think it's as
big an issue, as you do and given the alternatives, I'm willing to
make that sacrifice. How's other peoples take on this point?

-- 
troels

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

Reply via email to