Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66249 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15531 invoked from network); 26 Feb 2013 16:48:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Feb 2013 16:48:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain zend.com does not designate 209.85.219.41 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.219.41 mail-oa0-f41.google.com Received: from [209.85.219.41] ([209.85.219.41:58828] helo=mail-oa0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6E/C4-16132-667EC215 for ; Tue, 26 Feb 2013 11:48:38 -0500 Received: by mail-oa0-f41.google.com with SMTP id i10so5662500oag.14 for ; Tue, 26 Feb 2013 08:48:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=lXjEA1x+Cdxll1x5pIQRdo7shENZDK41oO76Fs3tfJg=; b=l8xsrPKB/W6DDK1eUfhXWwTWuM+HpRaR4PXHYy3cps6/nYP+erxPHUYPnupwClRi2M DTmdltBZKCRL0NWQP6epJgzjor7aQcwjwSjGn4zCyJeOsbt4bVWibdBc7Hf4j+ukUk7F DMgOAeZ1rB+FU0ADTB2JyqErL4M1XnQ8zLdQkWdh6mi+oXKqJk8MFklRENNCSMYWlVUQ 4rbtc/cjGN27SDBqIIiPiyjy3y5uQSEcGbSo1+BHro+A7uU9noI1IH2J0DjU5EVSz9Rg JGGFVz6DkeeKDRarFt9qYEgZDC6VG8BZvxtHtNwzRaHsrod3Qbpv6peSNCGCFCmCV6Hj Tbpg== MIME-Version: 1.0 X-Received: by 10.60.20.35 with SMTP id k3mr2019091oee.119.1361897315605; Tue, 26 Feb 2013 08:48:35 -0800 (PST) Received: by 10.182.237.75 with HTTP; Tue, 26 Feb 2013 08:48:35 -0800 (PST) In-Reply-To: References: Date: Tue, 26 Feb 2013 19:48:35 +0300 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary=e89a8fb206f2b7bb1004d6a36dcb X-Gm-Message-State: ALoCoQlWeZiNrv0alQouZbi724zlL71vMLnQcmu0h/bzyHvRexX7L9RKeugoSFYNAC74ft9EGNj4PVlTzmiTomtSAs2nQxdzT1nQmlPuL4yh7ADm5iPX/P6kCCHKrGw+5Fd3wZGsRL/L Subject: Re: [PHP-DEV] Allow (...)->foo() expressions not only for `new` From: dmitry@zend.com (Dmitry Stogov) --e89a8fb206f2b7bb1004d6a36dcb Content-Type: text/plain; charset=UTF-8 On Tue, Feb 26, 2013 at 7:10 PM, Nikita Popov wrote: > On Tue, Feb 26, 2013 at 7:41 AM, Dmitry Stogov wrote: > >> Hi Nikita, >> >> I like the idea. >> But note, that it may cause some unexpected behaviour and bugs. >> I didn't test the patch I just guess it on my previous experience >> introducing similar features. >> >> - usage expression in write context (e.g. passing constant by reference) >> >> function foo(&$foo) {} >> foo("abc"[0]); >> >> - destruction of temporary result >> >> ($a . $b)[4]; // if ($a.$b) is destroyed? >> >> - in some cases destruction of temporary result may cause destruction of >> final result >> >> ((object)(array("a"=>"b")))->a = "c"; // temporary object may be >> destroyed before assignment >> >> All these edge cases must be carefully analyzed. >> I like the current patch, and in case the edge cases won't require many >> hacks, I'm all for it. >> >> Thanks. Dmitry. >> > > All these edge-cases are covered by not being allowed :) The old (new > Foo)->bar syntax did not allow usage as a variable and I stayed with that. > I.e. (expr)->xyz will still be an expression, not a variable and as such > (expr)->xyz = 'foo' will be a syntax error. > At least the first case (passing constant by reference) is already in PHP-5.5 and should be fixed. > I stayed with the old behavior because I thought that it would just be a > small bugfix-like change that way, whereas allowing usage in write-context > could require larger changes (though I haven't tried, maybe its just as > simple). But now that everybody seems to think that this is a major change > that requires serious consideration, I guess I can have a look at the > write-context use too :) > Yeah. It's not a simple patch. In the past, we had a lot of problems after introducing foo()[$i] syntax, because some edge cases were not taken in account. Thanks. Dmitry. --e89a8fb206f2b7bb1004d6a36dcb--