Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125659 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id F33461A00BD for ; Mon, 23 Sep 2024 21:40:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1727127753; bh=7G6VLYfHkM1q8V8fyaBcRP3uxRHHLr6WZUqp6S5qwrw=; h=Date:To:From:Cc:Subject:In-Reply-To:References:From; b=SIxOdfjbGLgXXhVDDEwV8MdCHF9aRReFI5VvZrtDJUakf8UTzZGudib0xgUYTd3EV WZthi/T2k6VgJ8WzYTLE5Kd0uPNn/fKuKf/84MnKVb/VC0xdWf7JKhoVrQHpRyhD5s nRNZL5fDj+vNT9g0OruoKOsUT/mAZuCs7jOz3CQMjitYs/7P7W9cJS8FkmlbmKvtES azR4u/YQcFIFTzGZKTAmr3aFfknwLhtI0brSC6iuOIMUx70y+TfpJPVFyV4l+KFv4F 9Z48RxbcPaOiHrzuFOwCHHrL+4chup/rCNpdxUv1sr3DBs7MsK4KhBD6alPA0667G7 F4IxSCcUkqEBA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A5A7918006A for ; Mon, 23 Sep 2024 21:42:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-4022.proton.ch (mail-4022.proton.ch [185.70.40.22]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 23 Sep 2024 21:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gpb.moe; s=protonmail2; t=1727127620; x=1727386820; bh=7G6VLYfHkM1q8V8fyaBcRP3uxRHHLr6WZUqp6S5qwrw=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=BYtwUJYilSqyOx5LBplkza3cfbuM2SMMa+0aBPt0+LSF17GBBWE95L3WFRUiPhEnD VM8Zrn0WM0OAJ+G4oxlXk3SpF8LH5O/La9qgao0dgwvT5ymwdq3nYQxOCMIGvn1nLj /BQI6fKyg3A8b0PBuZX7YmejkW50w3aoVwdZpKPteW0pMc9IQJhvrYMOkrBVvtr16u EoZh+fBMlbKpwn4H2b8nnNLZUMi5RRYh6bcLGJdOlCRV5joCN9ijrWuYM2ELsy7key sj9295YHFBrpBgRn2ZzIO6nMPwG59R88M1BSxx5CMmT9788ywgQ+pg+rOaMfhYy+4v gocM6FsqwFj+A== Date: Mon, 23 Sep 2024 21:40:16 +0000 To: "Christoph M. Becker" Cc: Jordan LeDoux , PHP internals Subject: Re: [PHP-DEV] [Pre-RFC Discussion] User Defined Operator Overloads (again) Message-ID: In-Reply-To: References: Feedback-ID: 96993444:user:proton X-Pm-Message-ID: 886e4ae60b8f3fcfddf17befe04dd8c969dd25cf Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: internals@gpb.moe ("Gina P. Banyard") On Friday, 20 September 2024 at 15:09, Christoph M. Becker wrote: > On 20.09.2024 at 15:00, Gina P. Banyard wrote: >=20 > > This leads to a rather insane situation where the engine does not assum= e + is always commutative but does so for *, something which makes no sense= as multiplication or product operations are (in the grand scheme of mathem= atics) rarely commutative. >=20 >=20 > Gosh, I had completely forgotten about ZEND_TRY_BINARY_OBJECT_OPERATION. > So I withdraw my statement about the only reasonable way to implement > operator overloading in PHP[1], and state that there is no reasonable > way to implement operator overloading in PHP at all (excluding > comparison and equality operations), since apparently, we cannot even > get the only two internal bundled classes to properly handle this. > Cf. https://3v4l.org/gksqI/rfc#vgit.master and >=20 > https://3v4l.org/o5Uhh/rfc#vgit.master. >=20 >=20 > [1] https://externals.io/message/125550#125621 The issue here is that GMP does not return FAILURE when it does not support= an operand, but instead throws an exception, which blocks any polymorphic = handling. Being currently knees deep in the implementation of GMP it does some questi= onable stuff and should be refactored. However, the fact that if only one operand is an object and returns FAILURE= and the binary operation can still succeed is a bit of an issue which need= s to be address regardless IMHO. Best regards, Gina P. Banyard