Re: [PHP-DEV] variables in namespaces, was: On closures and lamdba

2010-02-24 Thread Stanislav Malyshev
Hi! 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. Congratulations, you have just discovered why OO exists :) Objects are not always the answer. If you refuse to use language construc

Re: [PHP-DEV] variables in namespaces, was: On closures and lamdba

2010-02-24 Thread Alexey Zakhlestin
On 24.02.2010, at 15:11, Alain Williams wrote: > On Wed, Feb 24, 2010 at 02:20:38PM +0300, Alexey Zakhlestin wrote: >> >> On 24.02.2010, at 13:28, Alain Williams wrote: > >>> Objects are not always the answer. >> >> in situation, which you described, objects are definitely the answer. >> you h

Re: [PHP-DEV] variables in namespaces, was: On closures and lamdba

2010-02-24 Thread Alain Williams
On Wed, Feb 24, 2010 at 02:20:38PM +0300, Alexey Zakhlestin wrote: > > On 24.02.2010, at 13:28, Alain Williams wrote: > > 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'

Re: [PHP-DEV] variables in namespaces, was: On closures and lamdba

2010-02-24 Thread Alexey Zakhlestin
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. >

Re: [PHP-DEV] variables in namespaces, was: On closures and lamdba

2010-02-24 Thread Alain Williams
On Wed, Feb 24, 2010 at 09:51:45AM +0100, Ferenc Kovacs wrote: > maybe you want to pack your namespaced functions/classes with the > global variables used with them. +1 > Tyrael -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 6

Re: [PHP-DEV] variables in namespaces, was: On closures and lamdba

2010-02-24 Thread Alain Williams
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

Re: [PHP-DEV] On closures and lamdba

2010-02-24 Thread Ionut G. Stan
On 2/24/10 8:56 AM, Stanislav Malyshev wrote: Hi! Correct me if I'm wrong, but given the fact that PHP only* supports functions defined in the global space**, with the additional ability to import global variables using the global statement, wouldn't that make named functions able to close-ov

Re: [PHP-DEV] variables in namespaces, was: On closures and lamdba

2010-02-24 Thread Ferenc Kovacs
maybe you want to pack your namespaced functions/classes with the global variables used with them. Tyrael On Wed, Feb 24, 2010 at 8:01 AM, Stanislav Malyshev wrote: > Hi! > >> I never did understand *why* variables were not namespaced. > > If you have so many global vars you need to namespace th