[EMAIL PROTECTED] writes:

> I don't think it's "really clean" to not return a *new* instance with a
> *new* call. I'm not sure what kind of advantage it gives you over a private
> constructor and a static getInstance($n) function.

"Really clean" in that I believe that it's the class' business what it returns.
If the class wants to be a singleton, the user of the class doesn't even need
to know it is getting the same object returned each time it asks for a "new"
one.  If the class wants to return a pre-existing object in some cases but a
newly-allocated object in other cases, I believe that's up to the class, not
to the caller.  That is a characteristic of the design of the class.  (I can
envision alternative viewpoints, however. :-)

Given my viewpoint, letting the caller request a "new" object each time (when
in fact the class intentionally -- sometimes or always -- returns a pre-
existing object because that's the design of the class), seems clean.

Two responses, two negatives.  Ok, I withdraw the request. :-)  I will not
belabor the point further, but will be glad to discuss the merits of this and
its implementation if any one else feels it could be a useful feature.

Cheers,

Derrell

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to