Re: Re: new overloading feature?

From: Date: Mon, 09 May 2005 18:05:50 +0000
Subject: Re: Re: new overloading feature?
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-16182@lists.php.net to get a copy of this message
Derrell.Lipman@UnwiredUniverse.com wrote:
Derrell.Lipman@UnwiredUniverse.com writes: Leonardo Pedretti <lpedretti@suserver.com> writes:
I would like (for code cleanliness purposes) to make 'new' return a reference to an already created object under certain circumstances without using a factory, is it possible?
A number of months ago, I proposed a similar feature, implemented as overloading a __new() function. At the time, it seemed I was the only one who wanted it, but your request is for a feature identical to my request. Here's my previous message. (The whole thread can be found under the subject "new overloading feature?" from 5 Nov 2004). I'd love for this to be revisited now that there's someone else with a similar desire.
I'm not an OO expert, but doesn't this break a fundamental semantic of OOP -- namely that new() returns a new object of the specified class. Isn't this the whole reason that the Singleton pattern exists? George

« previous php.internals (#16182) next »