Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:123972
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 87A7A1A009C
	for <internals@lists.php.net>; Thu, 27 Jun 2024 21:46:55 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail;
	t=1719524893; bh=stlWNGOOTr8C5muSWyfH5RU58ZbMhMU2257CjjS/Xnk=;
	h=References:In-Reply-To:From:Date:Subject:To:Cc:From;
	b=ciRIMDyYUL+ruzCHk9mcdMQ2mBP8x1hO+8zd/g8MdcuOth+oAm5yRpBqVmRcuFgun
	 rDF/1UOtATGSf7P4HtEpzkQBm0TaHh/dBGPH/+Uvu274wwijSHqnQjLz4W63+aKsMQ
	 lnSqv8nCy0UcREDsE9cHd581Xl9GAty0UCbrDCAFmuspkBJpQdgIYSRR21byfHAiif
	 PonQKR/1RiBkH9x68lfaMu48DP4R5wS3TX5iOrcHo9RtA8bR1YP/XVSJhw738H1cQN
	 wzBbgvxKhaPdahawshkMG0MiZrG82/KKGWCNCxHPzd4gZp1I3yH9Tl+ai7PsHcTY8j
	 7r9wV9rTY3YYQ==
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id 14173180847
	for <internals@lists.php.net>; Thu, 27 Jun 2024 21:48:13 +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,FREEMAIL_FROM,
	HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,
	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: <jordan.ledoux@gmail.com>
Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178])
	(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 <internals@lists.php.net>; Thu, 27 Jun 2024 21:48:12 +0000 (UTC)
Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1f6fabe9da3so67953305ad.0
        for <internals@lists.php.net>; Thu, 27 Jun 2024 14:46:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20230601; t=1719524813; x=1720129613; darn=lists.php.net;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=stlWNGOOTr8C5muSWyfH5RU58ZbMhMU2257CjjS/Xnk=;
        b=Hrdhw4ciHuU9JR31fePBg3ufNmxIDFRxZgcP1wzKPyF0fSk4k312JYfHhbrf15XkYb
         wakxwFU6AqjDIh+LfH82u/ScwDPFjVgbLuB2DdZlwMvsIlYlmK2pTKinfqa6CE7dG5u8
         G4Az42dq1KRcYMlCYc2CezPXCD7NZ6h0QdCeMwcXXS2I0H2SE4KYg40POiBpB/I+PCT3
         mxXc+2iyaniF6uW4gYeQiadsJPuKndJv8Bkr8GRvM11Y3jxrzK21NUI4QgPIUIbHPMQK
         pNgU/m13EqrHjuzVBfY61MwjE6Hx/zHfe7+5ubm6tvEbkOJX7rE+pjZHrUVYXZwyB+V3
         b8dw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1719524813; x=1720129613;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=stlWNGOOTr8C5muSWyfH5RU58ZbMhMU2257CjjS/Xnk=;
        b=iKf+caKQIlE68bdBIqmgTGtmiC9htSCuBCH7vZya48J1LwVsbcBc0tr0hAYHHh1ZFT
         lU77PqvItTyH+62aC/DXIj1pGOLj1cqTJOuQcfMf6M7xqBaperSTU2kTl5pIVxtxyDO7
         Rsq127FYKoJCczQc8YlL0ptPZ3NfeCW6pboP8FeDSV/326+Mfip8Ms2lCI/C9hfg8Nk9
         c4fGo5tewCaNHlhEF979FWByScOlivbtLxWbeDWv2Z2zpLIofgxQpLoZZzPpVLlk5+6d
         C0iuVVnfhd9hkq0biAxaDWVR8ioBZIcJSsyGXwhO6tzgKV2XP4MB/9DLYEH5rVwZY0Az
         N87Q==
X-Forwarded-Encrypted: i=1; AJvYcCWJB3AP1W29r8O61A0Cn/hXOMawbg/6ZTF+eJsVI9ek1aItt7Y36CI2m4/CVIemhZzQDNuGi4bnNrP+IssNRu2JIi1MREeKxQ==
X-Gm-Message-State: AOJu0Yw8ofFt8zi1lDztcSgm6Jp7bkhiTaic6tuyh9jK5kPjcMp1I2fp
	A3RVIdYgsj7xreIRUN/ZPM7ScgeGFAyb8vqD1E3RD4/H8VqqPygFYpIIcrgRKVs1HJTdPhdN82o
	872b9kfM0Hj2nbzo5HhihF8Nba/QoTA==
X-Google-Smtp-Source: AGHT+IG+h38wcenyn+13IDEMbOh0zZsXpu/2LVbiV4NamUXtTaLIe/B0A7d+mE0uLmbWTZSoyzgUwC1hu2p7xbtW+PQ=
X-Received: by 2002:a17:902:d481:b0:1f7:1bf3:5806 with SMTP id
 d9443c01a7336-1fa23ec69f0mr135855865ad.17.1719524813277; Thu, 27 Jun 2024
 14:46:53 -0700 (PDT)
Precedence: bulk
list-help: <mailto:internals+help@lists.php.net
list-unsubscribe: <mailto:internals+unsubscribe@lists.php.net>
list-post: <mailto:internals@lists.php.net>
List-Id: internals.lists.php.net
MIME-Version: 1.0
References: <930741fa-eb10-44c6-acbf-34ec9823f8f3@app.fastmail.com>
 <zOXTDXZ2k2tMAay7SG-gMaDYkE8LBIcm92bRqtJlldGwRFBls080opVX661CsOjlXFQpFuiqEbYB0RDn6ZYmQJ8BO8_CNZETt93N52CVtNE=@gpb.moe>
 <64BF2EC8-6B0E-4F5E-95C2-F5DE9B71D141@sakiot.com> <e665bb60-8697-40ec-9e8b-d83e0b8d5655@app.fastmail.com>
In-Reply-To: <e665bb60-8697-40ec-9e8b-d83e0b8d5655@app.fastmail.com>
Date: Thu, 27 Jun 2024 14:46:42 -0700
Message-ID: <CAMrTa2HyGkbVOCB_Gu4Pa6KWLOMqTfvK+=MmbphPtkSg_wJzbA@mail.gmail.com>
Subject: Re: [PHP-DEV] Overriding GMP objects
To: Rob Landers <rob@bottled.codes>
Cc: Saki Takamachi <saki@sakiot.com>, "Gina P. Banyard" <internals@gpb.moe>, internals@lists.php.net
Content-Type: multipart/alternative; boundary="000000000000ad906a061be61141"
From: jordan.ledoux@gmail.com (Jordan LeDoux)

--000000000000ad906a061be61141
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Thu, Jun 27, 2024 at 2:35=E2=80=AFPM Rob Landers <rob@bottled.codes> wro=
te:

>
>
> On Thu, Jun 27, 2024, at 06:07, Saki Takamachi wrote:
>
>
> I agree with Gina. Being able to change the class of a computed result of
> an inherited child class causes several problems.
>
> The points raised in the `BCMath\Number` discussion can be summarized as
> follows.
>
> - If it is possible to perform calculations on parent Class and child
> Class, what should the resulting class be?
>
>
> Ask the class what it wants to be?
>
> - Multiplying the distance class and the speed class should give you the
> time class.
>
>
> That would depend on the library=E2=80=99s implementation.
>
> - Similarly, multiplying two distance classes together should yield an
> area class.
>
>
> See above.
>
> - If only child classes have a property that should be specified in the
> constructor, how do you determine the value of this property in the resul=
t
> class? Perhaps it is possible to determine the value of the property, but
> in that case the commutativity of the computation should be lost.
>
>
> This can be handled via the child class in static methods, per the librar=
y
> specifications.
>

How is the library supposed to do that in the absence of operator handler
functions that can be overridden, or at least called when an operator is
encountered?

Jordan

--000000000000ad906a061be61141
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Thu, Jun 27, 2024 at 2:35=E2=80=AF=
PM Rob Landers &lt;rob@bottled.codes&gt; wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex"><div class=3D"msg-4281734687375525032"><u>=
</u><div><div><br></div><div><br></div><div>On Thu, Jun 27, 2024, at 06:07,=
 Saki Takamachi wrote:<br></div><blockquote type=3D"cite" id=3D"m_-42817346=
87375525032qt"><div><br></div><div>I agree with Gina.=C2=A0Being able to ch=
ange the class of a computed result of an inherited child class causes seve=
ral problems.<br></div><div><br></div><div>The points raised in the `BCMath=
\Number` discussion can be summarized as follows.<br></div><div><br></div><=
div>-=C2=A0If it is possible to perform calculations on parent Class and ch=
ild Class, what should the resulting class be?<br></div></blockquote><div><=
br></div><div>Ask the class what it wants to be?</div><div><br></div><block=
quote type=3D"cite" id=3D"m_-4281734687375525032qt"><div>-=C2=A0Multiplying=
 the distance class and the speed class should give you the time class.<br>=
</div></blockquote><div><br></div><div>That would depend on the library=E2=
=80=99s implementation.=C2=A0</div><div><br></div><blockquote type=3D"cite"=
 id=3D"m_-4281734687375525032qt"><div>-=C2=A0Similarly, multiplying two dis=
tance classes together should yield an area class.<br></div></blockquote><d=
iv><br></div><div>See above.=C2=A0</div><div><br></div><blockquote type=3D"=
cite" id=3D"m_-4281734687375525032qt"><div>-=C2=A0If only child classes hav=
e a property that should be specified in the constructor, how do you determ=
ine the value of this property in the result class?=C2=A0Perhaps it is poss=
ible to determine the value of the property, but in that case the commutati=
vity of the computation should be lost.<br></div></blockquote><div><br></di=
v><div>This can be handled via the child class in static methods, per the l=
ibrary specifications.</div></div></div></blockquote><div><br></div><div>Ho=
w is the library supposed to do that in the absence of operator handler fun=
ctions that can be overridden, or at least called when an operator is encou=
ntered?</div><div><br></div><div>Jordan <br></div></div></div>

--000000000000ad906a061be61141--