On 24.02.2010, at 13:28, Alain Williams wrote:

> On Tue, Feb 23, 2010 at 11:01:05PM -0800, Stanislav Malyshev wrote:
>> Hi!
>> 
>>> I never did understand *why* variables were not namespaced.
>> 
>> If you have so many global vars you need to namespace them, you should 
>> not use global vars.
> 
> It is not a question of number -- you may have some module where the
> functions need to share a couple of variables between themselves, eg a file 
> handle.
> If variables could be private to a namespace then you would be confident that
> you would not get a variable name collision with some other, independently 
> developed,
> module.
> 
> Objects are not always the answer.

in situation, which you described, objects are definitely the answer.
you have several functions, which share the same "state". that's very close to 
the definition of object.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to