Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124040 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 3F8791ADB15 for ; Sat, 29 Jun 2024 15:17:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719674329; bh=yJfS+VbpAcoOHl9Q29dbmfeNfzTTrnH89vnd89p3G3k=; h=In-Reply-To:References:Date:From:To:Subject:From; b=NfXKAN/r46RQRNuDDS0jVkvVDGmW0NCrNJt9lrV/0InV0DU/IIr1pmQ1PNKOagq/S 4visWKuItsWT/T3QTvMydzHTIifHecgu5n2FI2Rrr6oHmrmWCyi8KiUwuCg1SPTWjM YBUbC8g+MBz1FKvyzV2uChjT9cEYP3edtDcajvHbnfmtj+kI6B0kd6vrBswGKMFcA9 wSAlsOGcvBje5mzloXneKwpnl2y+SFAy7loCNo+C9/67VW3puMVTcBxiWy4u/vyCjn 2aXtUtaT68wi2D5d8+wXzOH7qfGXkeM4vq6Kfryi0NL6bAv+y4ReHMi3pqcqDliOLN FD02HUxfj15gA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 16F5B1811CD for ; Sat, 29 Jun 2024 15:18:47 +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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from wfhigh2-smtp.messagingengine.com (wfhigh2-smtp.messagingengine.com [64.147.123.153]) (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 ; Sat, 29 Jun 2024 15:18:44 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.west.internal (Postfix) with ESMTP id 2D2BB18000D1 for ; Sat, 29 Jun 2024 11:17:23 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Sat, 29 Jun 2024 11:17:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm2; t=1719674242; x=1719760642; bh=yUbcBEpDa1NNZ89tx/Of8 Wf/SVLMG1UzHV7BW4zlIXE=; b=FfKv4jMCzuy2bvOSYmDCjl9qtaXw8u1uouMQw nje6CZJYEruMdIolcqACRDM7CTVPs0mq3WvtgXdhU8NYmpzBoJXxM6AbSie2VtoJ LAfJRgahlbFz/NnE85SoafO/YuEppR1DU7uUu4Adok5hH2cD5K0A+M6Or0/oP0La yA7Po/PaePY4V5SsU9NmzRYhIz9zMvad4XcJ8eBtap0JEv2ZwFFjSdWbyfiTEgdK iDcQS/mnQdjfzQNkZn2cQqMkiXVVEwSF8TcZk9M7fOZNGQLnvdMGA7LBJdBpUZKC nqA767I6qri8eCIlezWvwjZQtyps6orGOIdAjSj4QLVqD4D/A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1719674242; x= 1719760642; bh=yUbcBEpDa1NNZ89tx/Of8Wf/SVLMG1UzHV7BW4zlIXE=; b=F dOIhd13LYsqurP0o9YKN6+5PIewzSpnsuNPNZCPtAxTVnInvpXFEzRmRvcJ/k9kK +1qm65iGwOudrM3ZzXMQpgbro77OAUD4iyLA/eU9isMVMhih3eUbjbxaAhPSDXRr UVb9asr7nXAz2lwGG8N8kUE/JHc5UeeAmHTg/mPOc7ZUReLcAUOCClOIx6DvIz9F RrU29JE7S0DlSWdaanIINfgiLHXTOjXn6npp5/+Al0t1VYe6hN1nI8F7aC8bD2qN G9b7Dw6Wr6k6fDvlzgreH3YBcrWsKtPqF0WNZxbuGIIdi4YidbPqQp7qplgZl7Pd TLyIU0SwDwtBtGhVJGZTg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrtdelgdekkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeffffffjeffudfggeevvdeitdetvdfgjefffeffjeel feejteevheeghffhvdfgleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 599EC1700093; Sat, 29 Jun 2024 11:17:22 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-538-g1508afaa2-fm-20240616.001-g1508afaa Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: In-Reply-To: <89C9AC15-1456-46AE-9183-DFDA7D0D381D@sakiot.com> References: <90dd3eb6-c7be-4951-a6b6-fd3785ed92e5@app.fastmail.com> <89C9AC15-1456-46AE-9183-DFDA7D0D381D@sakiot.com> Date: Sat, 29 Jun 2024 10:16:46 -0500 To: "php internals" Subject: Re: [PHP-DEV] [RFC] Operator Overrides -- Lite Edition Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Sat, Jun 29, 2024, at 7:28 AM, Saki Takamachi wrote: > Hi, > >> On Sat, Jun 29, 2024, at 02:13, Jordan LeDoux wrote: >>>>> 4. The `static` distinction is also fairly meaningless, as in PHP = there is no situation possible where an operator overload can occur WITH= OUT it operating on objects themselves. >>>>=20 >>>> For this, that is the wrong approach. The actual behavior is on the= type, not the instance. The object instances may not even know their va= lue, they merely represent the value. >>>=20 >>> A GMP object instance that does not know its value? What are you eve= n talking about? Can you show me some code explaining what you mean? I h= ad literally months of this argument for the operator overloads RFC, and= studied the overload implementations in six other languages as part of = writing that RFC, I feel like I understand this topic fairly well. But I= do not understand what you are saying here. >>=20 >> A few minutes ago, I sent an email where I accidentally made the code= non-static, and I think I see the merit in what you are saying. It felt= so natural to use $this that I didn't even realize I was doing it wrong. >>=20 >> So, looking at your RFC and mine, I think this can be improved. >>=20 >> What would you suggest it look like and then we can work backwards fr= om there? > > Here are my thoughts on your code. > > In theory, inheriting from this "improved GMP class" would allow=20 > overloading of computational operators. > > In effect, this acts like a "calcable interface", with the constructor=20 > passing in meaningless values =E2=80=8B=E2=80=8Bto the parent construc= tor and the add=20 > method allowing the user to freely modify the return value. > > This means that virtually any userland class can use the operator=20 > overloading feature via a "hack". > > This approach is completely wrong. Rather than proposing this as is, i= t=20 > would be more constructive to propose support for operator overloading. > > Regards, > > Saki For clarity (since I know from experience it's helpful to RFC authors to= have a concrete sense of votes in advance): I will be voting No on this= RFC. As both Jordan and Saki have explained, it's a hideous hack that = doesn't look like it would even work, much less be wise. I'd much rathe= r take a second swing at Jordan's original operator overloading RFC, whi= ch I supported and still support. Let's do it right. --Larry Garfield