Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112096 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 73002 invoked from network); 21 Oct 2020 21:36:28 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 21 Oct 2020 21:36:28 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 54BD2180543 for ; Wed, 21 Oct 2020 13:53:42 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 21 Oct 2020 13:53:41 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id CADD0FE6 for ; Wed, 21 Oct 2020 16:53:39 -0400 (EDT) Received: from imap26 ([10.202.2.76]) by compute4.internal (MEProxy); Wed, 21 Oct 2020 16:53:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=JhNYG1 H9VePnfRl3dRRqnYITXgoaGBK873aKWXOJLos=; b=S0PPEHfYD2cIlXjwIfHz79 i5f+i2Jrgn+MziL53/ZufIWXMUPvLcrxBg+NUbKs07iWghZlJrxP+R7tCZacqLzj A7HDWjlGveKWi6L++Ww+tCPRzGVMWIlCgvMqKM2cvt9nP22OVuN/yWvx2gF6xQMe RNc6CQPzkvGsNQ/MazrCm8+w1YTVJYwgdV2aCrtQ698QGmQ9PAt8B+1Or3Tm3/e+ aPmMX+bAVxrblVNw0+8cc87i5H49udgc2W5EOa/lEX42+jYwcXb0gnWE6L/YCGAk qG45GV0jqNJeh5xcBPXvCqN+vG2fB2+seAl9sYjExMeMhp9ah13IPCE7cJmtLbGA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrjeehgdduheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeevheehvdevjeelvdevgfelvefftdejkeelvdekgeeh fffgiedvjefhhfeltdduteenucffohhmrghinhepphhhphdrnhgvthenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhi vghlughtvggthhdrtghomh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id EF57314200A2; Wed, 21 Oct 2020 16:53:38 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.0-502-gfef6c88-fm-20201019.001-gfef6c888 Mime-Version: 1.0 Message-ID: <812317f5-dd87-497b-b483-bc3b7f3c2e7d@www.fastmail.com> In-Reply-To: References: Date: Wed, 21 Oct 2020 15:53:18 -0500 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC] Short-function syntax From: larry@garfieldtech.com ("Larry Garfield") On Tue, Oct 20, 2020, at 1:19 PM, Larry Garfield wrote: > A while back, Nikita mentioned that it should now be easy to offer an > abbreviated syntax for functions that are just a single expression. I > decided to take a crack at it and it turns out he was right. I thus > offer this RFC: > > https://wiki.php.net/rfc/short-functions > > Hopefully I made a decent enough case for it. It's entirely a > convenience factor, but I think for many OOP cases (getter methods and > factored out operations) and functional cases (where functions should > generally be a single expression conceptually) it does make the code > nicer, more compact, and more readable. > > *dons flame retardant suit* There's been some discussion on the PR that I'm looping back here for completeness, mainly about using "function" vs "fn" for short named functions. I can see good arguments for either, and in the end don't care all that much. My main concern was that `function` was easier to implement, but Sara graciously offered an alternate patch that uses `fn` instead. I'll make a PR out of that sometime later today. If we feel it's highly bikeshedable I'm happy to make that a secondary vote, or if a clear consensus emerges either way before then we can go with whatever that is. I think I moderately prefer `function` for visual consistency, especially inside a class, but it's not a hill I feel like being moderately injured on. :-) --Larry Garfield