Jeffrey Hutzelman schreef:
Hrm. OK, let's make it simple...
The global command is legal at any point in the script. However, it
must appear _and be executed_ before any use of the named variable(s).
Otherwise, the results are undefined.
This means the question of what happens if you use a local variable and
then call it global is up to the implementation. So is the question of
what happens if the global command appears in a conditional and that
branch is not executed, and then the variable is used.
I think it gets us all the same implementation simplicity as requiring
it to be "first", without painting ourselves into the corner of someday
having multiple things that want to be "first".
Eeew, this is getting hairier by the minute :) I don't see any benefit
for putting the global command anywhere else than the beginning of the
script, so why don't we just get back to the original plan in a slightly
modified manner:
"
A global command must be placed at top level directly after the require
commands or any other command that has the same top level placement
requirement.
"
And then more properly phrased of course.
Keep in mind that the problem I stated originally was only about
interaction with other commands with similar placement requirements and
not the flexibility of the global command in general.
Regards,
--
Stephan Bosch
stephan(_at_)rename-it(_dot_)nl