Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124036 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 436591A009C for ; Sat, 29 Jun 2024 14:46:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719672456; bh=Xy7QzlAaHTjIReOviFNYl9oWCHUNGmxcUS5WiZFGFSA=; h=Subject:From:In-Reply-To:Cc:Date:References:To:From; b=LBU+g8ym3wi9nPEmjhuKBNHnJKU02UdWVFXgAOt8iUxy3gfGrYs5jgoWr1BO1/Jji JxxhIb6wJtE+XAJayLzLSvyMhKBYVxIdYgaC/dKOpqcd4jlVaXiTO7jr0499pnDS6a tkMTDOWdNkaTq3ExIYXGZ2+AhPDMhZ/Sfvfu4q4bK+UaB5ulDVTe4GM3wZmpxkGmgA tuyzLIiM2o8+n7i7OOxqii/KU++2I5mFQVsJ40oqIxfT9FtblUPnXPLpw+aTEGtj7R x6Zg1HGZiSBCTaCiuW+73aUmZswlx/XaBesG3CYFCHaOXdZDTewHO9WVeOiDQdZOV1 lDIR06TqZwDLw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DE34C1804C6 for ; Sat, 29 Jun 2024 14:47:35 +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,SPF_HELO_NONE, SPF_PASS,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 mail.sakiot.com (mail.sakiot.com [160.16.227.216]) (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 14:47:35 +0000 (UTC) Received: from smtpclient.apple (unknown [117.55.37.250]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.sakiot.com (Postfix) with ESMTPSA id CFC87401EB; Sat, 29 Jun 2024 23:46:11 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sakiot.com; s=default; t=1719672371; bh=Xy7QzlAaHTjIReOviFNYl9oWCHUNGmxcUS5WiZFGFSA=; h=Subject:From:In-Reply-To:Cc:Date:References:To:From; b=LdJsg6Fzo1ykKZMCbiB6dGtc++XixtvPVMooNyYzQNWKFVucZCC/bQQtnDW1nLBwH dOS72lICSpzRumvM2DmtXtw9VzO5V7Ow9nY1DGmtRiyYQlnrGc6xh3XjDuVn+D48p9 +1aB9qQCwg28vZqVN07013d/3m1385pNxzLAq1JM= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (1.0) Subject: Re: [PHP-DEV] [RFC] Operator Overrides -- Lite Edition In-Reply-To: Cc: Jordan LeDoux , internals@lists.php.net Date: Sat, 29 Jun 2024 23:45:59 +0900 Message-ID: <7E6F1153-166F-419B-92BA-E0EA2B0984D3@sakiot.com> References: To: Rob Landers X-Mailer: iPhone Mail (21F90) From: saki@sakiot.com (Saki Takamachi) I'll add a little more. > I would like to state my opinion on this matter, making it clear that I am= of the opinion that "GMP class should be final." >=20 > First of all, to meet the requirements that are the basis of this discussi= on, it is not actually necessary to expose the calculation logic; it is enou= gh to simply specify the class of result. >=20 > A practical approach to get around this issue is to tell php what class th= e result should be. >=20 > For example, could prepare a method like `resultClass(string $num1Class, s= tring $num2Class, string $calcType): string|false`, and return the class nam= e of the result based on the class names of the two objects to be calculated= and the calculation type, such as addition or subtraction. >=20 > PHP calls this method as a "hook" when it finishes a calculation and retur= ns the result to determine the class of the return value. >=20 > But I don't like this because it's a "hacky" way of doing things with zend= . Also, I am concerned about the cost of doing this for every calculation. >=20 > The reason I'm putting together what I consider to be a bad method is beca= use it's possible that you or someone else will take my idea, add a twist th= at I haven't thought of, and come up with a way to make it all work. >=20 > Regards, >=20 > Saki This method is actually not as simple as it may seem. The problem of commuta= tivity still exists as to which to prioritize when calculating between diffe= rent classes. And if the child class has its own properties that must be specified in the c= onstructor, you need to figure out how to store them. Regards, Saki=