On Mon, 5 Jan 2009 11:21:56 +0100, Marcus Boerger <he...@php.net> wrote:
> What is left is moving something we decided upon so that it might look > like > something that is similar already avoiding to create a pretty new syntax > that in my opinion is unnecessary different from anything we already have. It's different than what we have in one place but similar to what we have in another. I'd say it's a wash in that regard. I personally prefer the explicitness of putting it in the function signature so that it cannot be lost 20 lines into the function. (It really bugs me when people do that with globals, because it makes them harder to track.) > In fact 'use' means create a static variable from the surrounding context, > while 'static' means create a new static variable. Actually the executor > does not know the difference at all. Next 'global' means allow to use a > global variable. > > So: > function () { > global $foo; > static $bar; > use $baz; > } > > Is pretty clear to me, as all three statements have a defined keyword. And > I would really prefer if all I have to teach is the meaning of the > keyword. And how do you teach that "global $foo" means by-ref and has no by-val, but "use $baz" means by-val but you can use & to make it by-ref? That's a major inconsistency that I'd hate to have to deal with or teach. > And to answer the other question. Obviously 'sttaic' and 'use' are > executed > at compile time, so whereever you place them, they are executed before > anything else. Thus it doesn't matter where you place them. Except to code readability. > So here consistency means placing a syntactical element at the same > syntactical location related syntactical elements are placed. Except for the inconsistency in behavior that results from doing so. And I would dispute that lexical/use variables are more related to globals than to parameters. --Larry Garfield -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php