Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125563 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 6C0C41A00BD for ; Mon, 16 Sep 2024 12:23:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1726489520; bh=oCwLPYHDJQYuj4yZwr7eLKNNkRVQMjeJohJVGQFvT2c=; h=References:In-Reply-To:From:Date:Subject:To:From; b=e6nhQsEu53dSJU2DYQlprfhyIVrjjoj55PXHb0O+eIyep1F/ujXXm6PCWDCbiIXNU FQJ/ggTuWhR1RHAVb5OG6q7QeaiQQHZwiPeSTB8L4gevAk0Jk7JNxWwsK88Ti0BVyE G1dfyNCxdfSdmRyvvMyDrza+yefdoGkgRe7LLgHVaLADJyZiHdd5u8osrhFPf3yp0p Z0/JGS3bgTSzb05Vn4hDEigMuHlkbg/WLeDcEPvNzvnTxsi2cxu+T5e5R3/vaUoxMl PC8I3ctr5MSvwfTSzX7Dh/Fphrpr0fWhhNmg6ocP4dwn5Or7lZPgdP4rOeWchNuWxM HsfkVUhZW1fmQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E6747180053 for ; Mon, 16 Sep 2024 12:25:19 +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_KAM_HTML_FONT_INVALID autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) (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, 16 Sep 2024 12:25:19 +0000 (UTC) Received: by mail-yb1-f180.google.com with SMTP id 3f1490d57ef6-e1a90780f6dso3427263276.0 for ; Mon, 16 Sep 2024 05:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726489393; x=1727094193; darn=lists.php.net; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=FuVXcoVP8kHqBxK2TJ5C/riuCHg+anvXrW9gG+XJixg=; b=RBI+Lno7gNU1EFvp4HxgfiX/p/Ibmj8gZrpopwfIddlgOXYh1D9UesAVh3yLVPu/a3 6K/0NZQ2fFUP4Fewgq+9896D7pbjnBhhIs3EqUVc5HHsJvKKgr0gKHg+sQCjFHBMtJ6/ JAM50nEFBFVzREaDHOeOx3HedAVpyWvA+4uJe5xruen1zRnN9DMuYAU9FuSJLZaaZzC+ FO/ANFAlSgav2QnobQO0NVitwDsIZGSyzYN6kUjEYhfh1qcFus6AC9AQqrooook6g4ay +5bQDDDclWf8XCiHRPTkk9CZlT9JMGoKEsF3raWyogNmCycCTckSQ1IaNYjof++Fnofm vOgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726489393; x=1727094193; h=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=FuVXcoVP8kHqBxK2TJ5C/riuCHg+anvXrW9gG+XJixg=; b=rOK75cnYzZY0fZucj2r8e9sTgE+UfajM6TFmTxiS+IWyxwBOZVX3SwzHvpIohqP+83 KloqUmYgWEXLRALpz1S2uaafZArWOQ4JaxFLlLFjwHWuosX7y2dOYjkmxJDbJxB/Cj3s Eqq+NteD15wBhkQKkxRwDKE6wWgZb+7P9OoiZjkC4hmEYtV7uEx1dVQknMHIwVjl3Z4v ld7oyltc3/XqSdRAwratdjKKWn2S0y7m6BlNUL0ou//dw6rhnPwnSy8pEBJJX0iZO2iH JSFVgMGGNjZ2SBPUmOIAECD+WGvZbW39Go0OMpUlmUvQeat7MtvyhDa/hPTvZ1vEz0an cbVA== X-Gm-Message-State: AOJu0YzQCyFHUpXlHiqPnwXk8Ul/wesw13VxQVt8tj29SOWSnsVkNgd9 jE5hyS3AaZags7tZ3x2Y9BDKmJ1fcb4r5FA4Y+0qzbdX7qBEkLG2rUmJeScT3OHpE2dQyodBjhk kWhaE9qwuiZqcDuhYXL5NwkFXH5VVrnm9Opc= X-Google-Smtp-Source: AGHT+IHavUtNiPZIR2iYFbbp1NTlIEqx14Ew1fKrK/f6Lmqe+eCsVSwmDGZv8pRbxQ51pnBqVdrLWPj8HF2w3fr8PEM= X-Received: by 2002:a05:6902:1b11:b0:e20:1103:67f0 with SMTP id 3f1490d57ef6-e20110368afmr29699276.57.1726489393133; Mon, 16 Sep 2024 05:23:13 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 16 Sep 2024 15:22:55 +0300 Message-ID: Subject: Re: [PHP-DEV] [Pre-RFC Discussion] User Defined Operator Overloads (again) To: PHP internals Content-Type: multipart/alternative; boundary="000000000000fc868506223ba22a" From: drealecs@gmail.com (=?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?=) --000000000000fc868506223ba22a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Sep 15, 2024 at 12:52=E2=80=AFAM Jordan LeDoux wrote: > > These changes could and should be provided independent of operator > overloads. Gina has been working on a separate RFC which would cover all > three of these issues. You can view the work-in-progress on that RFC here= : > https://github.com/Girgias/php-rfcs/blob/master/comparison-equality-seman= tics.md > > Unrelated topic, sorry for the spam. I just wanted to point out that interface default methods will play nicely with the mentioned interfaces: Equatable and Comparable: interface Equatable { public function equals(mixed $other): bool; } interface Comparable extends Equatable { public function compare(mixed $other): int; public function equals(mixed $other): bool { return $this->compare($other) =3D=3D=3D 0; } } So that it signals a clear intent of: "what is comparable is also equatable, and this is the default implementation for it. Alex --000000000000fc868506223ba22a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Sun, Sep 15, 2024 at 12:52=E2=80= =AFAM Jordan LeDoux <jordan.l= edoux@gmail.com> wrote:


These changes could and should be provided independ= ent of operator overloads. Gina has been working on a separate RFC which wo= uld cover all three of these issues. You can view the work-in-progress on t= hat RFC here: https://github.com/Girgia= s/php-rfcs/blob/master/comparison-equality-semantics.md


<= /div>

Unrelated topic, sorry for the spam.<= /div>
I just wanted to point out that interface default methods will pl= ay nicely with the mentioned interfaces:=C2=A0Equatable=C2=A0and=C2=A0Comparable:


i= nterface Equatable {
= public function equals(mixed= $other): bool;
}
interface Comparable extends Equatable {
pub= lic function compare(mixed
$other): int;
= public function equals(mixe= d $other): bool {
return $this->compare($other) =3D=3D=3D 0;
}
}


So that it signals a = clear intent of: "what is comparable is also equatable, and this is th= e default implementation for it.

Alex
= =C2=A0
--000000000000fc868506223ba22a--