Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32562 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6467 invoked by uid 1010); 2 Oct 2007 17:30:18 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 6452 invoked from network); 2 Oct 2007 17:30:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Oct 2007 17:30:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.162] ([212.25.124.162:31624] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8A/28-57391-92082074 for ; Tue, 02 Oct 2007 13:30:18 -0400 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 2 Oct 2007 19:30:14 +0200 Received: from [127.0.0.1] ([192.168.16.180]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 2 Oct 2007 10:29:30 -0700 Message-ID: <47027FF7.9030707@zend.com> Date: Tue, 02 Oct 2007 10:29:27 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: internals@lists.php.net References: <4702777C.2090406@zend.com> <47027B78.5070909@sebastian-bergmann.de> In-Reply-To: <47027B78.5070909@sebastian-bergmann.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 02 Oct 2007 17:29:30.0598 (UTC) FILETIME=[CA463860:01C80519] Subject: Re: [PHP-DEV] Class Posing From: stas@zend.com (Stanislav Malyshev) > Like I said before, the factory and singleton patterns are just example > applications of this mechanism. Right, but I'd like to see why we *need* it - i.e. what it allows to do that other things don't. I'm afraid that we might have a case of featuritis here (not meaning this specific proposal, I'm talking more in general state of affairs) in 5.3 - we will turn PHP from simple language into minefield of magic methods where you can't possibly know what the code you are looking at actually does. It might be useful for some applications but might hurt the language as a whole. It also can have a lot of implications what have unintended - i.e. how typehints are supposed to work with this? How reflection and autoloading would work? What with static methods and variables? > What I want to use them for in PHPUnit is improving the Mock Objects > system. As far as I know, Java has unit tests but doesn't allow replacing classes. How does it work in Java? > I hope this makes my motivation for the feature more clear. Yes, I can see the motivation now, but I'm not entirely convinced allowing to replace classes with other classes would be the best solution. I know there are OO languages extensively using unit testing and not having this feature - I'd propose looking into how it is done there. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com