Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13745 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58663 invoked by uid 1010); 6 Nov 2004 01:51:29 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 58617 invoked from network); 6 Nov 2004 01:51:29 -0000 Received: from unknown (HELO amber.vis-av.com) (66.92.75.243) by pb1.pair.com with SMTP; 6 Nov 2004 01:51:29 -0000 Received: (qmail 2781 invoked from network); 6 Nov 2004 01:51:28 -0000 Received: from unknown (HELO random.?none?) (192.168.1.9) by amber.internal with SMTP; 6 Nov 2004 01:51:28 -0000 Received: (nullmailer pid 19982 invoked by uid 0); Sat, 06 Nov 2004 01:51:28 -0000 To: cm@leetspeak.org Cc: internals@lists.php.net References: <1135.216.98.60.147.1099702310.squirrel@216.98.60.147> Reply-To: Derrell.Lipman@UnwiredUniverse.com Date: Fri, 05 Nov 2004 20:51:27 -0500 In-Reply-To: <1135.216.98.60.147.1099702310.squirrel@216.98.60.147> (cm@leetspeak.org's message of "Sat, 6 Nov 2004 01:51:50 +0100 (CET)") Message-ID: User-Agent: Gnus/5.110003 (No Gnus v0.3) XEmacs/21.4 (Common Lisp, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [PHP-DEV] new overloading feature? From: Derrell.Lipman@UnwiredUniverse.com cm@leetspeak.org 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