Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94480 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1219 invoked from network); 11 Jul 2016 20:22:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jul 2016 20:22:59 -0000 Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.29 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.29 out5-smtp.messagingengine.com Received: from [66.111.4.29] ([66.111.4.29:55563] helo=out5-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 29/23-17655-12004875 for ; Mon, 11 Jul 2016 16:22:58 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 2B92F20888 for ; Mon, 11 Jul 2016 16:22:55 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Mon, 11 Jul 2016 16:22:55 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=2JVkqdGFhddFLlV RkuDlFM5fGso=; b=DkpGDoX01HKGvCGExSVVRtQcsW0RGlzJCfVCRZofGa19EUB jDxvx/Ik8c+Zl+o3ZT+bkVnOmfCYlr/94k3zKaPIXAgxOm9Knd8Hq06x/csWsGC+ A5CS3g2Taj1DFuXcQRPpg/rBTw5cbG+sORhsKkqlc1hj6rMIWTDg9JmDhvrI= X-Sasl-enc: Xg2HKgWx2TkBF/PjBW3qu9nRlXTmjELBrgEQX/uhutRn 1468268574 Received: from [192.168.42.5] (c-50-178-40-84.hsd1.il.comcast.net [50.178.40.84]) by mail.messagingengine.com (Postfix) with ESMTPA id CE365CCD81 for ; Mon, 11 Jul 2016 16:22:54 -0400 (EDT) To: internals@lists.php.net References: <86455a1e-eb57-1f30-9016-ac70c9f30bdd@gmail.com> Message-ID: <5784001E.4060508@garfieldtech.com> Date: Mon, 11 Jul 2016 15:22:54 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 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: larry@garfieldtech.com (Larry Garfield) On 07/11/2016 11:30 AM, Rasmus Schultz wrote: >> what's the actual added value of this sort of operator? > The only direct value to the language is brevity - mere convenience. > > But I think the biggest indirectly added value, is that this will > discourage people from the chainable methods anti-pattern - so this > has value to the community; those who write chainable methods can > stop, and those who want chainable methods can get a wider choice of > libraries that were previously too verbose in use for their taste. As one of those proponents of chained methods / returning $this, I quite like this proposal. It neatly handles many (although not all) of the use cases for method chaining, specifically the most controversial ones, while not having any of the same potential issues. (Eg, when composing and delegating the method call to another object, you have to do some $this juggling.) It would not remove the need for all method chaining, but it would remove the need for the controversial ones that Rasmus is complaining about while letting people like me still write nicely compact and readable code. :-) (Modulo implementation details and debating the operator symbol for a few weeks, as per usual.) --Larry Garfield