Re: variables in namespaces, was: On closures and lamdba
| From: | Alexey Zakhlestin | Date: | Wed, 24 Feb 2010 12:17:14 +0000 |
| Subject: | Re: variables in namespaces, was: On closures and lamdba | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-47051@lists.php.net to get a copy of this message | ||
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 have several functions, which share the same "state". that's very close
>> to the definition of object.
>
> Maybe 'private static' -- ie shared between different objects.
> It is not always appropriate, eg a generic logging function, called from all over
> the place - it is not always convenient to pass a logging object around;
> you just want to call the logging function.
this one is solved by singleton ;)
gives real protection for "private" var as a bonus