Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109412 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 95251 invoked from network); 29 Mar 2020 12:26:37 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Mar 2020 12:26:37 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 200CB180088 for ; Sun, 29 Mar 2020 03:52:16 -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.20]) (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 ; Sun, 29 Mar 2020 03:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1585479131; bh=lMrCLbWyy0Io8TYr6qCSJoc2hCsZ1pxdtmXNqkH6f5I=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=bgAFf8drGSRnsYMTV4LXO6Wt86f2xLbyDxqMn7eNARhUH7Fi9eaySmfavOJfHehTL z5Hbz6uuHkaNIZwyLLpbKKdIx3NR/s5A/gGBREOmSvP+8v6gSWz43JOva99/0XBcUJ W6Pn524EKa3M3Ok8u8CMtwTsawTsJMupNoqluQN0= 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 1MTiPl-1jmMbv3kFh-00Tzd4; Sun, 29 Mar 2020 12:52:10 +0200 To: Andrea Faulds , internals@lists.php.net References: <003701d6013c$9afe9750$d0fbc5f0$@gmx.de> <7a83f950a31d94d5ff2307ac8219db3b7b6482b6.camel@schlueters.de> <12ad7c71-8958-7742-12c4-e83e359c8186@gmx.de> Message-ID: <780bdeca-aba1-b2ca-0400-4c2851e0ff50@gmx.de> Date: Sun, 29 Mar 2020 12:52:11 +0200 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:teuLvO65nt41OS6bTkMkr8hTN11NtgbUoDeOkXItRy8Bz3nawl+ HSl6VB0nHLeAixGX2fOFNyYA7v4aYL5ZpTemqbu/RFjj1ixNUuO95PZwq0Eeshrpco4Eis7 4dt/SQwT8JBZ7capswiAvvBod36ei1pifhu5NPj1Vj7esBWinjxvNwzAAaWo+U9T3SClaJO 9pbMgDWGUdHEurBampMpQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:eTp5Onu5WwY=:KROwzd42sepsuYix79pLN6 CA7jb6mjhjZ2rmQC4+r3VXIX/c/VcTrvQDKEtxRbqWP08vMxi1aQss6Xv29XvR4Cqi19QlFh8 dYsNYB1uUmEGaCwcuAGzFzppg+wPDbzZW6lqpVULmYbWVP9WcSkxQYcwUbR5XEI9VeU6ExFM0 jA7fwHB0HSex1uMrHqf5xeg/gPv6QP7gKjqMYwpTePUDYz5fYJS/kjZ3iKiOnYwZkV/NGbCO5 +JF+yLiiGrVI/iLhVzJCOeZ1+zjS12K6BBiq2dmD1KceSbrzzl5Fm5rBLmv8YQk8yoXRn6Nk+ ZTMTT4SEJcdvBrY7g4xpbFkXFApVtjWRkdnHSBxDmNiQKP9FmWMD7wWdVB0kEUxSei5nt2j9J +f6lrY7SIUUm6H+j321J/WA2MA+ZZXNwD3COLAepU/5yvQEsRyYqV4HUE+eIDaEz9JC2anCNB NjxRaRI+dLBkFojNJQ8fVAruCL3dej4040+cyfEaRlh8qx4NJGHAcGMfEcF8L1Rh3vCEfPvD0 heVrw6TrotBZWGmn4gAUiMq4BrjzXmwzCv5OQBUs21Rh19tVF/X6jU98uBlaQv5B7WmQBbW1z ycZW2UsVscg2LU5PVYAh5uCYeUjZRa4cWUGSbYwLx+HluhAj5KFljc2LWP/wuQr0fs0rynFpN FQYMRPGqkg0Kcus1SMqSIj11h/DAHEc2HZqHgEfjhKmZgXcuH/IKyxzO7BHVobaCNbRiivdck JNjIVB43L0s5K/ctx47hBjTVEdK4t73VZV9lB4BpT8GF4bs9xIospi2UnNDx6nx9ErYWFm0/Q zw2VLL0WyEbAE9PukCEyiFhaejvNQwwg8jHXu5K3DvktNqjlvYhxAx4ePWrWooFLk2NJ4Gl4F tEvouabO2CuBBaZpQmahT1+miCPjaoqvUZOk3hd+Yr4nZnp5eF87MqgAYyFYpDhYxsBKWfS4q cT808t0Jt+PWz/IyJtom7nDVnWhHMLNdWT1AEOtuam9qQftGatn1mnQ22Ob9px6C4hu4gEx7X dm3twCryvaZ9Vg39BoXAgJ92v2wzMn3e+jRR+rKbUNK9L+qZ/LoyEeSQZ/Ghjl/9QYKdadsxy 1/56UUfO1yMf3UdLaAMega/sugncicKZgnO3gkylC6zKOtgYzJQNDcGS10Atyvz9j4RI9Po7I NooTlPmWwS+c94fiyhF/DXgYjfmbjFpFNz5PIy4WtG6FX18SSe7SyiLzaul6US9TliN9qVj36 Z+0+hE2wWi3JTNihF Subject: Re: [PHP-DEV] [VOTE] Userspace operator overloading From: cmbecker69@gmx.de ("Christoph M. Becker") On 28.03.2020 at 22:21, Andrea Faulds wrote: > Christoph M. Becker wrote: >> (frankly, I would not have not supported __concat() at all).=C2=A0 Also= , >> overloaded operators should be programmed defensively, i.e. they should >> not accept arbitrary arguments (how could that even work?), but only >> those they can handle.=C2=A0 If implementations adhere to these "rules"= , I >> don't see real issues. > > Consider a type implementing some kind of list. Perhaps someone would > want to overload the + operator to mean adding an item to the list. If > the list accepts any type of value as a valid item, then you have an > example of an unconditional overload. I had already considered this, and wrote immediately above the quote: > If, for example, the + operator is overloaded to add something to a > collection, the normal expectation that + is commutative is already > violated. Operator overloading should definitely not be used for > "anything", but only for those rare cases which resemble math > operations Thanks, Christoph