Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122986 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 4B4261AD8EA for ; Fri, 5 Apr 2024 20:05:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1712347533; bh=XZ4nMsaOvog+wCJhgP9LBVu7prWirpo4fKalzBbC0Bo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=iPQMd0uq/ZckzT879+H0tCgXWbPRSq7WvnG/q0ufU7g7kbiL/PLyFhiaoVRhbsHBr l5Mdek3oonnbebvGM9+V5TKVAv7U3bU32x03k8r7BqRRnTnuP//vJAIMYbaQaH26FY beP/BP+G4lVPa1WpaC6jyhRoOC1eRQUttef8Td/RyVrb3eMu9SKIWdkH8rYuUx88H+ s4//zcgsuw08qU6S3TsrHQbKCtAsG5c5QTECchLk3j6qTJoJIek92nEp07qXhBxJBq vk6tUEO3HL6XucUtR0oJkPOhPXl7H1yQ4xcLOsD7cthd0zeWFsmPDI4NaP6sq5U3vp 2RdugSbUXGp2A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1BF82180E78 for ; Fri, 5 Apr 2024 20:05: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,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (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 ; Fri, 5 Apr 2024 20:05:28 +0000 (UTC) Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-5d4a1e66750so1696867a12.0 for ; Fri, 05 Apr 2024 13:04:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712347497; x=1712952297; 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=Hc5HvoMK+yEX7+b7KrkDlELQxPwN3zDWHsMq8IlGbzY=; b=EKWanefUVN/WPikPWfApY5EGLSKhXRQytF3557sbABgW4rw2GBc5B0VvkFi4hLQ13n n7jz43IvKlX6hhmAmGacAxQIv6M6AstEE8FDd5se+JuM7iDamhBDO/HJxU8/F5haJWKT 4sRtZp5vCVPqlYIC+mwxYqN81IsFVlO+bYGoEHJ3H6qPBL8YTIFcGbmFsc2Ga/Mx6cFa 1wv72AO8416tSeSY9dpuHMXMLPeKRNCncodwzqiE4/HtZmsxI20EmuaHwkmt48q4I+Kg 9+XT17hw+nnCXSXu9tOODq7TPm5JopQDwLrLh7upbD6e1yPbxI7vY0H1d72Iqipe/kH9 v0qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712347498; x=1712952298; 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=Hc5HvoMK+yEX7+b7KrkDlELQxPwN3zDWHsMq8IlGbzY=; b=UpCQHDWuuSxtutP7C10icqxSH5tmiaAZKp6sV+ix2b9AiqQTtKXERTPQ41e64pi2TP fBKqOTJ6oMT04mWZTqyUF/UZ3DptqH4DZVx8+TjsoSn8At2CrtFpbnL+5MKmbTTyTT8D Npt35sV7NwwAQTjJw5YkM7zjWL0LdlrupXZEHrwy9rC+NCwZyfSz/M1E14u3uz957Ksk lIC8EQMLZYiOYVb2GelXA4kJEwf4UCmpgcaCO9nIWwWlqEZWMy7WsqC7blLwAsf0tK4v hRBvgHJh3L02Q4UODUSS8LzuJuz7Oxrq0YjD4HNURD45deueVR7vBfzvtm9GHDqXqU0F c/zQ== X-Forwarded-Encrypted: i=1; AJvYcCWB1tjDd0hOSJZkYZTfSJTiuf3cI6/XPrrydYtowvihnmNGyRg9vE7fMyICIoiNHGy8heWlwbGr8dq+1yD3CCv4ZAJdJ7WpbQ== X-Gm-Message-State: AOJu0YyHun/MNYRmEyeCN5LQ/gcIlx54xDNLZayMAfor6wgO8POfMXuV L8SOFhzqturD0OjnpYeoswa1m1+3nzpBqCdubFJI55qQg9AzvxrsUzBI+GblKnV4IdnVYK8clnf GuPoO8qIG2Y6Ph52BSY46ro+0OH4= X-Google-Smtp-Source: AGHT+IF35HrIZAb1A+kVqB9IIEsdeE0AL0Qkja81rn+UDUwJtT7iOAd+PsLrSIfIEeGagxtfmccmTryvOzRgxT1QWlI= X-Received: by 2002:a17:90a:fc85:b0:2a4:7a2d:2c72 with SMTP id ci5-20020a17090afc8500b002a47a2d2c72mr1841380pjb.27.1712347497661; Fri, 05 Apr 2024 13:04:57 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <46B14427-44B2-4665-BC14-6018AC34B0CF@sakiot.com> In-Reply-To: Date: Fri, 5 Apr 2024 13:04:40 -0700 Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] Support object type in BCMath To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: Saki Takamachi , Lynn , Aleksander Machniak , php internals Content-Type: multipart/alternative; boundary="000000000000548c9a06155ef854" From: jordan.ledoux@gmail.com (Jordan LeDoux) --000000000000548c9a06155ef854 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Apr 5, 2024 at 1:00=E2=80=AFPM Tim D=C3=BCsterhus wrote: > Hi > > On 4/5/24 21:42, Saki Takamachi wrote: > > The only solution I can think of at the moment is to impose the > constraint that > > when computing operator overloading, if the operands are both objects, > they must > > be of the exact same class. > > Even that would allow for confusing behavior: > > class MyNumber extends Number { > private $importantMetadata; > > public function doSomething() { > $this->importantMetadata =3D random_int(1, 100); > } > } > > $a =3D new MyNumber(5); > $a->doSomething(); > $b =3D new MyNumber(10); > $b->doSomething(); > > $what =3D $a + $b; > > What should be the value of $what->importantMetadata be? The property is > private, so as a user adding two of MyNumber would not even be able to > manually fix it up with the correct value, thus requiring the addition > of a "fixup" method that fixes the internal state of the object, > possibly even lacking the necessary information to properly fix up the > state, because it does not know which operations lead to the state. > > Best regards > Tim D=C3=BCsterhus > That is an absurd example. Why would anyone use inheritance for that class design? If what you are arguing is "if you look at use cases where composition is clearly the correct choice then inheritance causes problems", then I'm not sure what the point of the discussion is. Jordan --000000000000548c9a06155ef854 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Fri, Apr 5, 2024 at 1:00=E2=80=AFP= M Tim D=C3=BCsterhus <tim@bastelstu.= be> wrote: