Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109340 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 43282 invoked from network); 26 Mar 2020 18:12:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Mar 2020 18:12:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EBAA1180531 for ; Thu, 26 Mar 2020 09:37:17 -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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,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 ; Thu, 26 Mar 2020 09:37:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1585240632; bh=VypnvVsSm7Y/k5P+hcuuDwVfdNnptsfmwvgFYie+Dbw=; h=X-UI-Sender-Class:From:To:Cc:References:In-Reply-To:Subject:Date; b=IbZeKtRTRdY4fxJJC+8AVEzJDVgPoFB5TtnaRxreC8w3mhPguviIjiVU0+RejO+ia f+oztlF2ZOq53KXvJ5b/kBR7xD1Ofp8Lswo8mFgnSMSLf1SvCeW0q+l/+E61G3iXcO Mk5H7MlGnt6yqQnCUQ1WaXO0Jq5eWehu+7yfnZrM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from DESKTOPF2PTDOD ([83.135.98.12]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MOiDX-1iswVD3E59-00QDiK; Thu, 26 Mar 2020 17:37:12 +0100 To: "'Jakob Givoni'" , "'Christoph M. Becker'" Cc: "'PHP internals'" References: <003701d6013c$9afe9750$d0fbc5f0$@gmx.de> <379095fd-ba11-4d84-6cab-89905eeab32a@gmx.de> In-Reply-To: Date: Thu, 26 Mar 2020 17:37:02 +0100 Message-ID: <004501d6038c$c7870df0$569529d0$@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQJhA3CUe9vS9hOq0bNeMXk6llj72ADzlMokAW3ZrX6nMfe8AA== Content-Language: de X-Provags-ID: V03:K1:gDUe7QbMNvUmRGi1GKDGEEWyW1IbBbEhfmSxjrUdiMVAN6i7Saa nfc2HA0+NI8h3JhG2YBGt9EdsOQ5DREhFCLn8zIXgpbZcqFswYv7vTY/GBaaNN3skpXmzON 0XUH2CWjeH1BEds1ttfLVsSS7Xeprfrln4N/ch3LnSGMGKpA+buhXQ3v24wR6MQQby2glUV 3uTPzA1r8D+8I5V6EQN8Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:vX/eqpbVAEI=:tTEciEEDQnNdRRNZsbFduk LB5CCQ7vhA2UVHiWBkxSuF4tdn5OhivNKNIUH8f4HGQY6qfo8KQBzYdZKvxEtkNplaH4YkhN5 2P6O8GgQnF5bTI7ufEE9zB181gTBBONPRf7nQ313+wcZ63pZOqLwf2Ve29DjzF3pKEpMW8pN/ 5xJunw7M8jeQrZSXIc9Erq1zwCs1I1ih41PHS7etPrnYP+t72qtEOL8PE4yFxSYLxHAw/uts0 gnH4DRJ56OJTLfnqvlJTrQv/87xWl7M0wJH6Kosdg2LtQQmUtO+2vBTrEjmWHuD1NoobV5kOM h5cDcvpog+Sy8MVN/XQRE2dy6ESA0tiDSE2dOYdkgnlyD5yY077FfF13CsQ5zpk1b26L9X8Cc 0sMiHtErEJ9pdX8oiYAO8nacWK0ooSB5QqCn6KDXQIvbgUYyEtK/SN3dH6Bza6glUV0iQfJUa 9c02nF8z8dHlLejQ28A/p6cYdQgALCz/P3n5PtOfIAdMBniR4eQWez7unOQ1hMXBKx1U/1JE6 IVqofjdcOdtyBKKU2dcGX2lnGUpJW3VVheTCbQoR8wH1Mc8InBdqIB7KmE2ms/TTz/Hc1dJBW H5cN7JEl0kMaOyTeetQ0oGr3vasZymhz+VnRv2xKnfd6YB3h+OKbp4ieDKNZw+cbTY5XIrcRV xcrBFjSf4yAIn7ucTGjQZp2hWJXE2apMWwjQdu7idKz/BcKaeXEacPg04S8NH8tn9eCNjLY6V hRrsmOJtqH+GwS0CPgkwhTViq3zQJa0rF4wzOoAER9N3iDwyFbmVz7A4R8+HE2pnJQPzPwm8P MQ4uu9IWcW1DGQPCSdbvMV0/5po/CP85qjuw4ALwXUNtoZqtgr30ZclvqnX9PzJuRdPOjoZOa 1wD8mhJPOBQIUTxAO3Oyt38Qppf7gNxVyf9OGIkZoLgGFprw6Mr3M5KK/Ec7sufiNWfbOvhFk PmYgrTsofCHgJ6w7XtgOAHUAhwRVpZsRmpVvVtfbQ0QZCgDF2PM8lkV9mln4nfKC/ZnhmpYqS RJOR22hUKuo5Fy2B9CgepTO+phOQDrxesKfuo2T2R3DqxB30vdl+GuBBHaZ0gSsa5yRaF7k7m nyvJzY9QoHMfK87UDUOegfxkOIZDTdaI9j78tmKc8Dwvkc0B0tDditXUMNLThJjBRLIEeV6X4 eVoKIwM/9mV/CoD6j005yzyh6VqnMm4JoPd5SVx9NIIWDkADtcWkO1n4WSgGlhdt3Qc+WoiuF WyJPPFdYmBFB6GrQE Subject: RE: [PHP-DEV] Re: [VOTE] Userspace operator overloading From: jan.h.boehmer@gmx.de On Thursday, March 26, 2020 3:50 AM Jakob Givoni = wrote: > On Wed, Mar 25, 2020 at 6:28 AM Christoph M. Becker = wrote: > >> It seems to me that the RFC is not sufficiently specific enough=20 >> regarding the concatenation of instances of classes which implement=20 >> __toString(). > > Exactly what I was thinking too. Would be nice with some examples on = this. I am not sure if I can (or should) still add this to the RFC, here some = clarification on this: The overloaded concat operator has higher priority than the __toString() = method. So if Class A overloades the concat operator, then calling $a . $b means = ClassA::__concat($a, $b); (Note that both operands are passed in their = original form) If you want to concat the string representations, you will have to = explicitly convert the objects to strings:=20 $ret =3D (string) $a . (string) $b; If the concat operator is not overloaded, the behavior is like now, and = the objects are converted implicitly to strings (so $a . $b actually = means (string) $a . (string) $b). Furthermore an notice is triggered, hinting the user that he could = overload the concat operator. (Maybe here a different message than for = the other operators would be useful).