Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112203 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 92124 invoked from network); 8 Nov 2020 02:50:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Nov 2020 02:50:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B5D81180508 for ; Sat, 7 Nov 2020 18:12:23 -0800 (PST) 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_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) (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 ; Sat, 7 Nov 2020 18:12:23 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id C28B6340 for ; Sat, 7 Nov 2020 21:12:22 -0500 (EST) Received: from imap26 ([10.202.2.76]) by compute4.internal (MEProxy); Sat, 07 Nov 2020 21:12:22 -0500 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=OANlu8 qeNo/tXFgPbWhx5c+2i/2/8dw8/dYagcrYv8k=; b=CVbs4uBfxIvFnWaiOfRCIo fIyISGMNhuZWrme33ZhcUlUQDeyWfu3Gdj6tFI2xVz00w5BDN6Vp+0eMDgCxo0/C G7dyT3WQ5+Hz90tD87YuVlLO1VNDcUxaqCo5rAuck0G1fEqc7b/aVBwc8nqueRa8 /vwXV4MmctrD6ILB3XuWFjTt58qF3cnU7jtpCdSAyAJXCwnNTPFG9S72AEN3qF1Y pTqadXeLJpr1N6fQdcBfTtSjTVp6o5rmnTojzZqqT9qb/4duZnMoT/IKRPkCQL5c BTL7iWvzeVER6xpS0MkKDl0mUDtGO1CaF0KJwlZLM5ciw1NLz/ESsOJ8Z8FmJnqQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudduvddggeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpedvgfekgfduhffhjeeufeefgffhgfejvefgfeekkeek hfeluefgteejheekgefhveenucffohhmrghinhepghhithhhuhgsrdgtohhmpdhphhhprd hnvghtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep lhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 0542C14200A2; Sat, 7 Nov 2020 21:12:22 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.0-570-gba0a262-fm-20201106.001-gba0a2623 Mime-Version: 1.0 Message-ID: <57bb761c-48d1-41ab-9c91-d9ada8cfe26e@www.fastmail.com> In-Reply-To: References: Date: Sat, 07 Nov 2020 20:12:01 -0600 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC] Support for ::function syntax From: larry@garfieldtech.com ("Larry Garfield") On Sat, Nov 7, 2020, at 5:41 PM, as@php.net wrote: > Hello internals, > > Looking for feedback on the idea of supporting `::function` syntax (or > `::fn`) for consistency with existing `::class` syntax: > > $arr = ['apple']; > print_r(array_map(strtoupper::function, $arr)); > > (Apologies if this has already been discussed. Hard to search for > colon-colon-function.) > > Benefits in my view are readability and potential use in static analysis. > Downsides (as implemented in proof-of-concept) are that it can be > needlessly littered in a lot of places, and that it breaks class consts > named `function`. I'd vote against it in its current state, but if people > like the general idea maybe the drawbacks can be addressed with a better > implementation. > > Examples: > https://gist.github.com/adsr/2c0b9243986418af3cecf8046657304b > > Proof-of-concept: > https://github.com/adsr/php-src/commit/07bb24243022ccef5823f6977d231f3535a48a07.patch > > Adam There was some discussion earlier this year, although if memory serves it was in a thread whose name would not be helpful for searching. Sorry, can't help there. :-/ (Maybe it was in the threads talking about ::class notation on objects? Just a guess.) Working strictly from memory: * There was a lot of support in concept, but not universal. * There was a lot of concern that ::function was just too damned long to type, so plenty of bikeshedding about shorter names. * There's another RFC proposed that is currently stalled due to lack of time to add partial function application, which would kinda allow something similar-ish through a back door: https://wiki.php.net/rfc/partial_function_application . That said, I don't think they would conflict so I'd be fine with both happening. +1 from me in concept. --Larry Garfield