Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116771 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 88137 invoked from network); 3 Jan 2022 13:29:25 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jan 2022 13:29:25 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BD4261804A7 for ; Mon, 3 Jan 2022 06:36: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_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS19151 66.111.4.0/24 X-Spam-Virus: No X-Envelope-From: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 3 Jan 2022 06:36:23 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 8447B5C004A for ; Mon, 3 Jan 2022 09:36:22 -0500 (EST) Received: from imap43 ([10.202.2.93]) by compute6.internal (MEProxy); Mon, 03 Jan 2022 09:36: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=5EOCxG Tv/rkxWlBz9uzyyjXzYteSRVztiY2UiWTxdx0=; b=XBGWTtSokTRblbAryewoiU 1s5ADog/Dygv77WEumI0peRBrTdkpYTZf1652LtCkstaLK2gZQb9GDRbm01ObAh/ Pf3rcG9zi1qYE0/b5kr31rsaT+Nsng8TuIblZ4NNGOw3ox0Uv16/tJa3bFdkmNev IsViPr1k/fdK7FdXWkoj9Lpj1pGaxt+5od/XqMlVx6SKt7ScVuLcmE2spFUw3mXk 4JX/gAWvJIw/4VnTCjHfBpzTpyoBEYE1rJe4I8Ltzamhpa1kLgdyMQNd+8UCupC5 TtIU/q548vmlmSFENcSBNGtNqKooccd5Bn8Z6DOmohoc696Db8hxnThR/4opyo7g == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrudefuddgieeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeegfeffkeeltefgkeelgeelffffudejjeevvdejtdel keduudefleelveffueehjeenucffohhmrghinhepphhhphdrnhgvthdpvgigthgvrhhnrg hlshdrihhonecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 12120AC0E99; Mon, 3 Jan 2022 09:36:22 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-4525-g8883000b21-fm-20211221.001-g8883000b Mime-Version: 1.0 Message-ID: <21fdd060-0e97-4fe2-aa1c-a196f334b8e3@www.fastmail.com> In-Reply-To: References: Date: Mon, 03 Jan 2022 08:36:00 -0600 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [VOTE] User Defined Operator Overloads From: larry@garfieldtech.com ("Larry Garfield") On Sun, Jan 2, 2022, at 6:13 PM, Jordan LeDoux wrote: > Hello internals, > > I've opened voting on > https://wiki.php.net/rfc/user_defined_operator_overloads. The voting will > close on 2022-01-17. > > To review past discussions on this RFC and the feature in general, please > refer to: > > - https://externals.io/message/116611 | Current RFC discussion > - https://externals.io/message/115764 | Initial RFC discussion > - https://externals.io/message/115648 | Pre-RFC discussion and fact-finding > > Jordan I have voted Yes on this RFC as well. PHP right now is littered with inconsistencies between its various types. Redesigning the whole thing is obviously impossible, but allowing objects to hook into behaving like other values piecemeal (as this RFC does) is probably the best option available. Not every object will need every operator, and that's fine, but in places where they are useful, they will be *really* useful. I just ran into a place 2 weeks ago where the <=> or == overrides would have saved me a ton of time and effort, and allowed objects to work with more existing utilities. (In this case, in_array() with value objects, which right now is impossible without a ton more pointless work). Just those alone justify the RFC for me. I also believe this RFC handles more edge cases to nudge people toward good usage than any other proposal could. I really don't see how it could do better, without relying on other, even more controversial unimplemented features that may never exist (method pattern matching). I do think this is the best we'll be able to do on this front, it solves a real and present problem I do see in my own code, and it has clear extension points for the future (e.g., supporting arbitrary operator symbols if we ever decide to). That's all we can ask for from an RFC, so this has my vote. (I also find it odd to argue that it is bad because it will lead to confusing code, but at the same time argue it's bad because it doesn't allow arbitrary operator definitions. Those seem mutually contradictory positions.) --Larry Garfield