Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115661 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 9222 invoked from network); 8 Aug 2021 02:56:19 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Aug 2021 02:56:19 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 60AF91804AA for ; Sat, 7 Aug 2021 20:26:12 -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_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS63949 74.207.252.0/24 X-Spam-Virus: No X-Envelope-From: Received: from malamute.woofle.net (woofle.net [74.207.252.100]) (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 ; Sat, 7 Aug 2021 20:26:11 -0700 (PDT) Received: by malamute.woofle.net (Postfix) with ESMTPSA id 577B71F0C7; Sat, 7 Aug 2021 20:26:10 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Date: Sat, 7 Aug 2021 20:26:09 -0700 References: <94696d46-c4e6-406a-b859-89144bff31bf@www.fastmail.com> To: php internals , Larry Garfield In-Reply-To: <94696d46-c4e6-406a-b859-89144bff31bf@www.fastmail.com> Message-ID: X-Mailer: Apple Mail (2.3654.120.0.1.13) Subject: Re: [PHP-DEV] Revisiting Userland Operator Overloads From: dusk@woofle.net (Dusk) On Aug 7, 2021, at 15:28, Larry Garfield wrote: > As an example here, time units. Adding two hour:minute time tuples = together to get a new time (wrapping at the 24 hour mark) is an entirely = reasonable thing to do. But multiplication and division on time doesn't = make any sense at all. Or, maybe it does but only with ints (2:30 * 3 =3D= 7:30?), kind of, but certainly not on the same type. This touches on another important question -- how do we plan to = represent: 1) An operator which is only applicable when an operator is used on two = dissimilar types (e.g. TimeTuple x float)? 2) An operator which can be applied to an object, but with a primitive = or otherwise non-extensible type on the left hand side of the operator = (e.g. float x TimeTuple)? 3) An operator which can be used with multiple types, but whose meaning = and/or return value can change based on what types are used (e.g. Matrix = x Matrix vs. float x Matrix)?=