Hi Andi,

> I guess this bug needs to be fixed somehow but I'd probably 
> just not allow it to be defined as global. 

Well that's of course the easiest solution. But does not solve the
problem.

> The whole reason for making it an auto-global was so that 
> it'll be easy to use. People know (and will know) that 
> $_SESSION is a global. 

I don't question the auto global thing. Hey, that's great. And PHP
People will know it, of course. But programmers used to use other
languages and reading the code say, for the first time, don't know but
will know almost instantly when they see 

global $_SESSION;

It's a matter of style of course and I don't want to argue about it.
It's personal taste. But as a matter of fact:

global $_GET, $_POST;

works fine, it's only consistent with the language that global $_SESSION
should work too.

So either it should be forbidden using "global $_AUTOGLOBAL" (which I
personally would dislike) or it should work with every autoglobal.

> I think your explicit marking of it as  a global is not a good 
> idea and doesn't really give you anything. 

Why not a good idea? Well it gives me nothing from the technical point
of view. But it's good style to tell the non-php-nerd how the code works
as best as possible. It should read like a spoken language (more or less
of course) and telling the reader that the variable $_SESSION that
suddenly appears somewhere in a method does come from the global space
is actually not a bad idea, from my point of view.

I view it as comparable to "do I have to init vars or do I not?". Of
course you don't but..... ;-)


> Why not just add a comment if you really feel it is needed?

Ok, that would be a workarount. But good code should not need such
comments as it is self explaining through its grammer.


Best,
Andi


--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to