Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116784 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 13467 invoked from network); 3 Jan 2022 16:07:39 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jan 2022 16:07:39 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9140E180543 for ; Mon, 3 Jan 2022 09:14:38 -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.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8560 212.227.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (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 09:14:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1641230076; bh=Txi1IIXG6/WwrCgWVJ6bWex9njkS0T86+EMwjAGvvqg=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=JPG0ENPTLaGDW3CDfPzOBhMl9r9OKEgnAk1xQcKE+SA3p6ntuMPyT/uqkD+gSS1Od kE80Rw3Z8LALIL9qWV3IODKavEr1EddyCxNRvewTanhJfr24RsNaAXHB+E1oLle01C 9+hRSFjP06YJlHWFI/SYxbKsbWzoIOrnPwqy9IIk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.50.96] ([91.138.42.26]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M3UV8-1n3sgY25fG-000eZo for ; Mon, 03 Jan 2022 18:14:36 +0100 To: internals@lists.php.net References: <3225c921-9b26-d2e0-f76f-45fff6f5a12a@processus.org> Message-ID: <58c84b7a-036b-5965-e457-b8deb0aa7944@gmx.net> Date: Mon, 3 Jan 2022 18:14:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-Provags-ID: V03:K1:NXfAmbSM0lvjLlybVRlKSGTDFGaAuXMrXK0WNM10EjgTyHmq1kl I2fJ9STHC7ohM8nRuFn4/TDe4IwFQ4ezk/QzZG/tYdcS1nwEaXL+Mt/xZH35qzl6i3gX3SW /TxorS2Fz8WktIxiDt41l6hXGcyyAz7S9WOojLKCFFyouil/CYhDXNt4la1hHW6wPhwacuA 58xM26QIBGce7ayLSbFpA== X-UI-Out-Filterresults: notjunk:1;V03:K0:D6JcoZIhTkY=:Yu54IcJbC5Tu6pma+TzGBs dqxqieh1k40zPlj11xTmsvSUSReVPyLzyPNQS6hgzpERNhqrBke6bqTzRgPttEx3nP+qK2MXh 1hmvWCMxv+xyY74OQYMY4JOAw7Tixps5vGXHtzC9mprXh4l59lsGg+0qaUEXEX/UQ0eGmwrkb CQ7io4TCdsKcCGNTin5OZaaxaAt4/4G2njcVP1yiZVwJP93OI1xvyAO/Jyoq2kqHBpRxUmYIv H7xASgqr6oWJXGOu8AnSQM6a7o6RH3lsvrgQwdqPhh67gB4SDx8nRVf/Jb6jb8F9MWvGnRB8z f7yKVlUj4rmtf2xdptMsRAEQNucI92M8xWkclrMO/E9V6Xs1hESFPZh8xayDU0p32MU9Nf9Qm g0j1FCkxkxoxOutaXfAEXuA07FLGxVhzP0bosfdhbZdFcLvSd1sIa+U/WByArcnWCeG2YRSD0 DDZT3Zw/u2HMOSg0LTeL/7X7LjYEyPmXRY6S5vuQh2dTfqUwxFblgALnWM3VWuS1CTSo12DEV UiQfGkfZo8c3wGQi2Dr4awk2QblbsOsAy/o4erLPcrUDasafOvIZJfq65dRtS+6fSzokrGIXJ 0rJGQpzWiKDFdbSRu2/3oTLrxEL5V7JfcouOZaYFeiuwFkkaND6uAOZ6gvncRxC/gsjhOtYqs NDn/ApDKzJxiz6VSanb1hPSqyqxgDpegTsPHHTk8+ElbCp70qpGX45vAqGoiK7rRdVBtxU0tP nyUGvmHaWC2WdA2k29F1YzMz6QN5DVmVsC6UFX3NrQDvUlBbPim+HY+65H8NLgCaWr97dAzLi UPytfKTUY6NmjtaOzY3GW7K+Um0RQWNsLIUsLcUFiDPjhSpJQmu6+e2tKnhGnMqh/WkisCNAe 4DTfPIngwUNHohdLYyEOrYzHpANpG+wbYyHzBNBlHy5mo/BTWc5+6+V9T9TFHC2gjDGroRKNi PGE9B4WQhV//KcobjMZZxdzX2nLAPkLcmzIu4KRIXoddTkgG3r2QvmsobYQUHew/swdGUWMy6 XTX2iiAe4xTkVvFXZUoEzB4S1MmYhIYBlHOAqJ9AEy9QvD05kwuckvuYNdFeoW9jmAM+zDZqc NhKj2tDuZcuUQ8= Subject: Re: [PHP-DEV] [VOTE] User Defined Operator Overloads From: a.leathley@gmx.net (Andreas Leathley) On 03.01.22 17:12, Larry Garfield wrote: > Also, people keep talking about edge cases. In my experience, "are > these two objects equal" (for some object-specific definition of > equal) is very much *not* an edge case. I may have less use for > overloading % as I don't use advanced math that much, but I compare > things all the frickin' time and that would be incredibly useful day > to day. Maybe some of the resistance against this RFC is the (understandable) focus on mathematical (or mathematical-adjacent) operations, making it seem that the "real" use-cases are narrow, whereas comparing objects could make quite a bit of code more readable, like comparing addresses, prices, availability or location/position. Having regular methods for operators is possible, but when used a lot the readability does start to suffer. The difficulty in arguing for operator overloading might be that the use cases are specific to a codebase and mainly become apparent once it is available (currently you just work around it). I do think it is a reasonable tool to make some code vastly more readable, and I don't see "novices" using operators a lot - PHP has many simpler features to abuse that can make code absolutely terrible. The RFC is really well thought out and reasoned, by the way - great work Jordan!