Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94491 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75547 invoked from network); 12 Jul 2016 15:34:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jul 2016 15:34:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.49 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.215.49 mail-lf0-f49.google.com Received: from [209.85.215.49] ([209.85.215.49:33591] helo=mail-lf0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 97/FC-17655-90E05875 for ; Tue, 12 Jul 2016 11:34:33 -0400 Received: by mail-lf0-f49.google.com with SMTP id b199so17231031lfe.0 for ; Tue, 12 Jul 2016 08:34:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=ceDu0hmDTr5b57k++CgRy3fWbQg/hVmNK0SPaHHkliU=; b=U8GLWzdKNGYnXxiO3m29jDtPUOTeRjCXvQ3oqra3oRGWaigk5oMQTbuI/qrAsgNbBX urh1t3Z1dbIOEDjwu5kEdGowL7y4DcWnmb+m7mPimzFKfJKf9KLJijKdg1PTKl3vsS75 bXzVdhYf1lUMpNSGnILZpcYgqQIhqr9ZGj3rw1YWXaKKh1TgXEdzlWGDW9LxlFmDdNeg viMS10veOJnVDQyqn33tW6YCGHCPWHZ3fK2mRPcRS+BSr9Ck6G24BWf8ATEH/4wn5F3l iOGhJNvFiAzibaMKpoFZVR1TQNfRLYX8oDHCsTjj1xxKGyxmznMTxUf+RYD7c5cQsIwn t9RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=ceDu0hmDTr5b57k++CgRy3fWbQg/hVmNK0SPaHHkliU=; b=h5NgV4+69ko5zhTouU6BnWxkzjUV5MWGDLwBYq+e2IxedAQpGv4YbX1n2+Hb7np4qB iDsdJdj+JBhSShuU4C0NUxlu6MRjm8INKW74pYQVpZMfCuA4REvWIH7Egpl96Meo3AjY 83AP6Iwtjhn2oHQ8helckg1M8xF/RRTD6R7oss6onyoRXNY2UyYaTn6peNI2KNU3/ANp gkJRhdPLLCodGquiBFZbcuY447DAxU1Q4KnBNcIot+x9lOvwMeGnkzIlfTusOfNM7eBo B40Q1s2RHYV0UDK2rSklDBmvRE0vxdalB0gCoRXGksHg6jrd4gBGs2DMqmDYyC4THuwa IarA== X-Gm-Message-State: ALyK8tLOsIA5wyBXFpL4w0qyrh8zWdokFaXLrMqpfmuyw719MNFIj/VryaIrIpmFMlNsgw== X-Received: by 10.25.28.21 with SMTP id c21mr1472131lfc.68.1468337670140; Tue, 12 Jul 2016 08:34:30 -0700 (PDT) Received: from [192.168.0.98] ([93.188.182.58]) by smtp.gmail.com with ESMTPSA id u14sm4093414lja.11.2016.07.12.08.34.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jul 2016 08:34:29 -0700 (PDT) To: internals@lists.php.net References: Message-ID: <89013ea8-3fdb-5f2d-519f-4ecbb36b7a39@gmail.com> Date: Tue, 12 Jul 2016 16:32:40 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Cascade Operator (was Re: [PHP-DEV] Proposal for php7 class method return) From: rowan.collins@gmail.com (Rowan Collins) On 12/07/2016 14:54, Michael Morris wrote: > Agreed, but what about static methods? Triple colon perhaps? > > A::setFoo(1) > :::setBar(2) > :::setBaz(3); This is a rather different feature, because you can't really express that as an expression returning something. What is $result set to if I run "$result = A:::setFoo(1)"? Or, equivalently, what is the value of the chain you've written? (Presumably, the "::" on the first line should be a ":::", otherwise I'm even less sure how to read it...) I think saying "if you want the cascade operator, you have to use an instance, not static methods" is reasonable enough. Especially with the perennial discussion about namespaced functions being better than classes with lots of static methods (if only we had function autoloading, etc, etc). Somebody quoted a concise explanation of the cascade operator earlier, which bears repeating, in PHP context: // Proposed $result = $foo->>bar(); // Valid in PHP 7 $result = ( function($subject){ $subject->bar(); return $subject; } )( $foo ); // Long-hand $foo->bar(); // discard return result $result = $foo; There's no magic needed to create longer chains, or combine this with other operators; it's not a transform done to the source code, just a normal expression. Regards, -- Rowan Collins [IMSoP]