Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109382 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 51345 invoked from network); 28 Mar 2020 13:59:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Mar 2020 13:59:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 454C71804B8 for ; Sat, 28 Mar 2020 05:25:15 -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.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,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.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, 28 Mar 2020 05:25:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1585398311; bh=ve8U8FU1mpGigSbCn8fL+7AUNBCam64J020L7iaTGMo=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=fDm96eV7Cu+gLjmgHCjsju/yBFA/c6taP2OwCeIFkg/PD0YE3h55cknknYNbPtJ9P +rM901t9KoiTuq7qWJtlvaEtUV7VOYAodxuEBM5x9v14isp45u+syjVT6xx0b3mBxg DSYXYao7vx0zBtKlcamO7gqyEPfhW2VvCXclE+bI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.2.130] ([84.179.237.201]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M5wLT-1jAljw2GrL-007XB2; Sat, 28 Mar 2020 13:25:11 +0100 To: Arnold Daniels , =?UTF-8?Q?Johannes_Schl=c3=bcter?= Cc: PHP internals , jan.h.boehmer@gmx.de References: <003701d6013c$9afe9750$d0fbc5f0$@gmx.de> <7a83f950a31d94d5ff2307ac8219db3b7b6482b6.camel@schlueters.de> Message-ID: <12ad7c71-8958-7742-12c4-e83e359c8186@gmx.de> Date: Sat, 28 Mar 2020 13:25:11 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:G3U5HZjqgiYEC6yvIOHUghnbn3SmKhkUQkW+521AXy2l/eP1RVN yYEA0i08aFO2w7jXFxkM42Wf34ykATjdlkOhiuAb15DI+4AvRyGO3oVDAURLcVBNb5vuyu9 NUXjumh78SGSPhUjYtalja4zVhxH2PxWfKuTjG4kOyg3KCRhOnw8/5Oiod93JUkzJgUPXGu RkfmFyJqtLjkiyLz4OP4Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:c8A6AdvHUEQ=:ruRtMZJXjtzNUoqnp+OKOK /bWBK8c43+BxwnWmLayA0V7XVaz3C3meaJyTMxUisVOIPUY3csDtx82YQ0rzo/lMOHbkQXW6u Vv7RNEL4LF5PLPf/khPxgWqyoWcXnklvw5gU3+fTnTmVr4qUbia3nMbFT7w2gJfaaL/gt4MbE fPiDAx+4ni+qk3/AQfYp1ufepz8EYDfShwS2JbxJJ/lVnSdbW6egWKXQCaNKjSsvm2uX/O0tb YhkL/QEFMmIanm5A8nU7hKdh9kix0OwUcz0pB9zRod/d1W8rxZrHz1Oj9Qe7KxME6mMheu5E1 ISP9vIHRxuDARdXZiAP0nZCjqLP4moYW3awqfDZZ9rXtdBLE8df4H7QbaNA5iwNnSK8FLQs8l tVjxlrBHpKHQxi4WAkslcNiXqd8dOfcbf3JjNfePbMKfGk9CeXGDaz03HnX6u8Iqv3BUWCx3O hdTGo5NvaIs5YB08TVdI+1Y1pE48h8Sz849SFc3z2MHfqavDejar4hH1mRM6KepzJTnEKr3vj JiLqrN5Gq18XvtHUVct5JoSo5GCNgFxCCPehtk9Rdmwuh3XaBUDv4uFPkfajB6aeGu//et/Uk oKWYg60/hjz5eDXR7XUadJM1pg3XCJb2ZLGTcxSFSZKkx+p1Ir5ekXb4L3+favQSxaMHyhYA7 DnZGaU1AD/aiTQGfJA82S0e/tOgs/b5y6sbtrmMjg04j0TckxJ8redoYeFGUNI0xgByTZTKx2 iPQGd/b1U/ozeVBrnzy3I6z1E36y96lq0nF/225yzJKwcGmF+VaRSK5cv91XbmC8G04EIrII6 SFJOqTogpJ1CjUJgrnm5pWoiHqeYWvpOe+YMYbhkw7gpnJ1knZSYqrr4ug5LHPbIaKP+mjknT UNAmJ924OKDgolIUD8EwDo//y2ANiweQl85oU/CuVGPikCFvcry6ajNvd7j2+CfNFMiL/ruKL wxIDDSrdJFFw21KRa5zIowyDtxBoNDmtVKl6tJooW1AaN/1H6mwr0WRb7OENrnOdJUO/d6wR7 IDz1Gy6X9AJ/ukqxIKjeSxD4hul7zILIRPXY50GgLRvnJ+M3rDNOt5m91Wtao0co707Qn3oCL 7jdT5aK6EuwWhgnfQnQQsz6PYNQwZqfaAXXJYhe7jDkUOh6dLOQ9PsIMGnd1CntiUGcwuNFgH 9KSfbVq2mOWB5Hfvmh9uuBnLS9aF2ZYB10UsMnFB9gb9HXiY32N7v2uxptaOKH/85ML1XBInf mkuokRttuubQX8rXl Subject: Re: [PHP-DEV] [VOTE] Userspace operator overloading From: cmbecker69@gmx.de ("Christoph M. Becker") On 28.03.2020 at 10:22, Arnold Daniels wrote: > This issues become even more apparent when sequencing operations like `$= a + > $b + $c - $d`. Trying left, then trying right, will make it very difficu= lt > to determine the outcome of such a statement. > > The arguments against type hinting for operator methods, assume the "try > left/right" method. Instead, type hinting should be applied to determine > which method should be used. If both or neither methods are applicable, = an > error must be thrown. This "try left/right" approach is how operator overloading works for internal classes[1], and apparently, it works quite well, as long as it is not overused. > With class inheritance, you also don't want to rely on the order of the > operands. If you're the creator of a library, that's out of your hands. = If > both the parent and child class overwrite the operation, and both accept > the operands, then the child class should always be used. If a subclass overrides the operation, it would have to conform to parameter type contravariance, so it would always be used, anyway. [1] =2D- Christoph M. Becker