Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109391 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 83191 invoked from network); 28 Mar 2020 16:32:00 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Mar 2020 16:32:00 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4E3861804D0 for ; Sat, 28 Mar 2020 07:57:27 -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=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS31103 84.19.160.0/19 X-Spam-Virus: No X-Envelope-From: Received: from mail.toneristzuen.de (mail.toneristzuen.de [84.19.169.162]) by php-smtp4.php.net (Postfix) with ESMTP for ; Sat, 28 Mar 2020 07:57:26 -0700 (PDT) Received: from [192.168.2.46] (ppp-188-174-60-166.dynamic.mnet-online.de [188.174.60.166]) by mail.toneristzuen.de (Postfix) with ESMTPSA id 7E59549BDB; Sat, 28 Mar 2020 15:57:24 +0100 (CET) Date: Sat, 28 Mar 2020 15:57:21 +0100 User-Agent: K-9 Mail for Android In-Reply-To: <12ad7c71-8958-7742-12c4-e83e359c8186@gmx.de> References: <003701d6013c$9afe9750$d0fbc5f0$@gmx.de> <7a83f950a31d94d5ff2307ac8219db3b7b6482b6.camel@schlueters.de> <12ad7c71-8958-7742-12c4-e83e359c8186@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable To: "Christoph M. Becker" ,Arnold Daniels CC: PHP internals ,jan.h.boehmer@gmx.de Message-ID: <3B71F74D-8142-48FB-9660-835B08D1DDDD@schlueters.de> Subject: Re: [PHP-DEV] [VOTE] Userspace operator overloading From: johannes@schlueters.de (=?ISO-8859-1?Q?Johannes_Schl=FCter?=) On March 28, 2020 1:25:11 PM GMT+01:00, "Christoph M=2E Becker" wrote: >On 28=2E03=2E2020 at 10:22, Arnold Daniels wrote: > >> This issues become even more apparent when sequencing operations like >`$a + >> $b + $c - $d`=2E Trying left, then trying right, will make it very >difficult >> to determine the outcome of such a statement=2E >> >> The arguments against type hinting for operator methods, assume the >"try >> left/right" method=2E Instead, type hinting should be applied to >determine >> which method should be used=2E If both or neither methods are >applicable, an >> error must be thrown=2E > >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=2E The fact that it works in one or two cases as an implementation detail whe= re the full implementation is controlled by a single group (internals) is n= o indication for it to work at large=2E >> With class inheritance, you also don't want to rely on the order of >>the Inheritance is always complex=2E Yes operator handling (especially if type= dispatching happens manually) will add a few things to think about=2E Cert= ainly an interesting field to explore, before one votes=2E I myself conside= r larger inheritance structures a thing of the 90ies and for special cases = like GUI widgets =2E=2E=2E but yeah, language design has to consider it=2E = Changing languages features like discussed here in future is hard=2E johannes