Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19554 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77308 invoked by uid 1010); 10 Oct 2005 17:23:55 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 77292 invoked from network); 10 Oct 2005 17:23:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Oct 2005 17:23:55 -0000 X-Host-Fingerprint: 84.204.52.251 promo.hnet.spb.ru OpenBSD 3.0-3.4 Received: from ([84.204.52.251:13999] helo=promo.hnet.spb.ru) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 8F/CE-54476-AA3AA434 for ; Mon, 10 Oct 2005 13:23:55 -0400 Received: from thinkpad (unknown [10.1.0.118]) by promo.hnet.spb.ru (Postfix) with ESMTP id 753A71BACA0; Mon, 10 Oct 2005 21:23:14 +0400 (MSD) To: "'Matthias Pigulla'" , Date: Mon, 10 Oct 2005 21:23:40 +0400 Message-ID: <000001c5cdbf$5f9adf40$e902a8c0@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 In-Reply-To: <00A2E2156BEE8446A81C8881AE117F192C1603@companyweb> Importance: Normal Subject: RE: [PHP-DEV] return /* by reference */ new Foo() in PHP4 From: dmitry@zend.com ("Dmitry Stogov") References: <00A2E2156BEE8446A81C8881AE117F192C1603@companyweb> I agree that allowing "=& new" and disallowing "return new" by reference is inconsistent. But PHP4 is stable tree. We don't like different versions with different behavior. In PHP5 "=& new" is deprecated, so I don't see any reason to introduce "return new" by ref in PHP5. Dmitry. > -----Original Message----- > From: Matthias Pigulla [mailto:mp@webfactory.de] > Sent: Monday, October 10, 2005 6:04 PM > To: internals@lists.php.net > Subject: AW: [PHP-DEV] return /* by reference */ new Foo() in PHP4 > > > > > Von: Derick Rethans [mailto:derick@php.net] > > > On Sat, 8 Oct 2005, Matthias Pigulla wrote: > > > The point is that this requires really unlogic and silly > > > workarounds > > > like 'return $tmp =& new Foo()'. That forces people to > touch stable > > > codebases; I find it comprehensible that they feel this is like > > > passing the engine internal problems to the php coders. > > > I discussed this with Dmitry today and we agree that although > > this is strange, we will not do any modifications here as PHP > > 4.4. is stable and we don't want to risk breaking things. > > Yeah, keep 4.4 stable and make sure > it does not break things. Delegate these problems to the > developers of PHP code >:) > > Sorry. I know you put big effort into recovering from this > kind of problems and did not have fun with it either. So, > this is something that is too complex to handle in the > engine? I mean, if you can detect that what follows "return" > is a (php level) function call that returns a reference, why > can't you handle "new" the same way? > > Explain someone (maybe new to PHP) why "new Foo()" creates a > "thing" that can be referenced, as you can assign it by ref > like $a =& new Foo(). But you cannot return the very same > referencable "thing" from a function and make the assignment > up one level in the call stack? > > Yes I know - it's just a notice. But it hurts to add hot air (semantic > NULLs) to large, stable codebases just to make inappropriate > notices go away again. > > Matthias > > PS. Anyone ever thought about explaining the whole > reference-related decisions on the upcoming International PHP > Conference? Maybe that could help to gain understanding as to > why the changes were necessary... Maybe also give a statement > as to possible breaks in BC with the advent of PHP6? > > I have the impression that a lot of people out there are > frustrated and unsure as to why they should fix PHP4 code to > rewrite it for PHP5 and to port that to PHP6 in a few > years... Why not stick to right now? > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >