> What you are suggesting is that a let statement would switch PHP to an 
>altogether different mode where function-scoped and explicit global variables 
>were suddenly disallowed and an error within that function (or only after the 
>let?). 

No, the variables with the *same name* as the variables in any "let" in that 
function body would be disallowed. In this proposal, variables, parameters, and 
closure uses with different names can be declared and used normally.

I mentioned $GLOBALS as one of the ways in which this proposal is a 
best-effort. However, I'm not proposing to ban $GLOBALS (but to ban $$var).

- The top-level statements of the file can either be the global variables or 
the variables in the function which required the file. It's not known which at 
compile time, so I don't plan to ban $GLOBALS.

> That sounds like a bad idea to me as I'd have to look at the whole function 
> to see if there is a let somewhere to determine the function's/variable's 
> mode.

A developer would run `php --syntax-check` to know if the variable is being 
accessed incorrectly in a file.
Various tools or scripts exist to do that, in Continuous Integration or in 
editors/IDEs.

If you meant something else, could you give a code example?

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

Reply via email to