Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39786 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17996 invoked from network); 8 Aug 2008 23:48:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Aug 2008 23:48:01 -0000 Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.163 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.163 il-gw1.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.163] ([212.25.124.163:18971] helo=il-gw1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7D/B2-02575-F2BDC984 for ; Fri, 08 Aug 2008 19:48:01 -0400 Received: from us-ex1.zend.com ([192.168.16.5]) by il-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Sat, 9 Aug 2008 02:48:45 +0300 Received: from [192.168.16.110] ([192.168.16.110]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 8 Aug 2008 16:48:41 -0700 Message-ID: <489CDB59.70406@zend.com> Date: Fri, 08 Aug 2008 16:48:41 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Marcus Boerger CC: 'PHP Internals' References: <489CAD75.2060404@zend.com> <1961502655.20080809000521@marcus-boerger.de> <489CC5BD.4060701@zend.com> <221319091.20080809002725@marcus-boerger.de> <489CCB62.8010406@zend.com> <122515992.20080809010008@marcus-boerger.de> In-Reply-To: <122515992.20080809010008@marcus-boerger.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 08 Aug 2008 23:48:41.0980 (UTC) FILETIME=[499FDBC0:01C8F9B1] Subject: Re: [PHP-DEV] by-ref return & inheritance From: stas@zend.com (Stanislav Malyshev) Hi! > What makes you think there won't be a problem with the reverse. The caller > does not expect a reference but the calle returns one? In OOP the return Well, I don't know any case where $a = foo() would work in a substantially different way for the user if foo() returns by-ref and not by-val. If you are aware of any such case - please tell, that's exactly why I ask. > value of the derived class' method must be an instance of the class defined > by the base class' method or a subclasse of that. And so far we tream them > different, rather than a reference is a subclass of a normal value or vice > versa. Err... I'm afraid I don't understand what you mean here. By-ref return is not a subclass of anything - not only PHP has no type control of return values, by-ref is a zval flag and not a type - so I don't think there are any subclasses here per se. What is relevant that value returned by-ref can be used in by-val context. The question is very simple - can you (or anybody else) think of any scenario that such override would lead to any problem LSP-wise? Any code that wouldn't work with such override? -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com