Re: Variable Scope

From: Date: Sat, 30 Aug 2003 18:24:49 +0000
Subject: Re: Variable Scope
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-4278@lists.php.net to get a copy of this message
That part of the for loop is inherently declaratory. As a result, the interpreter should add any variables in that portion to the new symbol table of that for loop. Any most other languages, that portion of the for loop creates variables specifically in the scope of the for loop. Other variables of the same name are masked. Its a matter of function. If you don't change it, so what. But completeness of logic is the hallmark of computing. That's what separates the true masterpieces from the crap, the Apples from the Microsofts. On Saturday, Aug 30, 2003, at 11:49 America/New_York, Rasmus Lerdorf wrote:
Of course it is a matter of typing. In a loosely typed language there is no concept of variable declaration. -Rasmus On Sat, 30 Aug 2003 LingWitt@insightbb.com wrote:
Its not a matter of loose typing. Its a matter of the function of the first part of the for loop construct. It is used to declare (or "create") variables for use in the scope of the for loop. Its this way in virtually every language. Moreover, with the current implementation, the part of the for loop of which I speak could be left out without trouble. Its unnecessary. Furthermore, a new implementation should not affect old code. On Saturday, Aug 30, 2003, at 11:02 America/New_York, Rasmus Lerdorf wrote:
PHP, is a loosely typed language. If you want a strongly typed language where you can redeclare and re-use the same variable names within the same scope, then use a strongly typed language. There are plenty of them around. This will never ever change in PHP.


« previous php.internals (#4278) next »