Re: variables in namespaces, was: On closures and lamdba
| From: | Alain Williams | Date: | Wed, 24 Feb 2010 10:28:12 +0000 |
| Subject: | Re: variables in namespaces, was: On closures and lamdba | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-47047@lists.php.net to get a copy of this message | ||
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.
--
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256 http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
Past chairman of UKUUG: http://www.ukuug.org/
#include <std_disclaimer.h>