Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122890 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 2DE8D1A009C for ; Tue, 2 Apr 2024 18:52:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1712083969; bh=EtgWwNb0QCRcTa6JlvayNjiKZLiH73Vu+EpLCjSuEX0=; h=References:In-Reply-To:From:Date:Subject:Cc:From; b=h8sMe9lCd0102v3RvOIOhsrvuau7kpMSJqJT96txvpV+H8z+xJ1hJkznUoiEQn5g8 ZEk0vssl7SQYRqUtC8cMo78hs63N84dNdYzd13xXhLRrBxeGf/BPAdFomBqpGaFSot dJFzYu4zghzLXu4aWOEEruyrCmtG4hJ2NkfwmBeu5Vx9IM6Q2qOMIeyPRM3pmOSLB/ hFBLYQx+f+ETdD+pp6hG4DWsosWlzNYe2UWBFAlfeMg052cuEDOEBkBuHLUAjO4dAt 6l3YwS0wadD88pv0nqxL+ZpMP5w2R1iVZJ2ajDC5IG5zcSTnkWSKpEgzM9bgGFU0YO WLWrbvKuixVcw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5C28C18099E for ; Tue, 2 Apr 2024 18:52: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=1.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, MISSING_HEADERS,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-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) (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 ; Tue, 2 Apr 2024 18:52:45 +0000 (UTC) Received: by mail-qv1-f46.google.com with SMTP id 6a1803df08f44-6962e6fbf60so47471546d6.1 for ; Tue, 02 Apr 2024 11:52:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712083936; x=1712688736; darn=lists.php.net; h=content-transfer-encoding:cc:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=SkHy7mXQkZEjZPXtsGwjePTMyHA3udfS+ADFSgSJn9s=; b=UTP9WNe8uq1k2yUS5QsFg+t/NwHGrju/kD852JZeHIK3Liyo060G1z5LB9kltZCveW pDCfFIKQVJb4Hi4jLBglY2nMxb9UqZW253TGU9nilz9/X++XfQY9dqtNUy96cwPryiQN fjpY/flgqhTbvzuwdl7egtm5EZN1p/3gFIpAanoxeY0YzjmhDDweg2Y+xP+SMlTih5Yc ihHDnVKeSWewCej2wRE9cnOaIUpwgt/F/cWlZsCHREZuznqrqBsV21D8z5JWuhpTVWvu aUdI4CP8dPNArBTW+FIYVhEvZdapO6doevrhd7ViUTGZ7Z43HqWugweF72J/8Cllzobw MYeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712083936; x=1712688736; h=content-transfer-encoding:cc: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=SkHy7mXQkZEjZPXtsGwjePTMyHA3udfS+ADFSgSJn9s=; b=GH/POCqBVrS2mIMtenJz92VDigPHU+WuXpJgA5XO0BMqKtP45PQJiaBdHbxp6Ohsq+ mdsZuGTyHYJIU32aBE2qZrL1QhYlgNCH5vLU8g3SJ79utQuEzAed+v3k1r6c1YlvyZAq VTmSKHW3InoTjZpiXQCk75HVmQDexym6mw1VR86CU9xHtAGg9PlAcK0y0ex+6XXST6f0 /rl6UV+5Il3/MG62d5kFAxIgnvO/pOboNsM0SK/h+vJ4hiRc/cSOSxG/fB8DVNYeSDjB D2hWo0AQlRPAtWNaoSwWQZUWULE70BSjrZ6qOb8/gL5sY/cx2ZNrdZYwVlur5uNjII41 oqFQ== X-Gm-Message-State: AOJu0Yz1ciOvS7ElcaOD8z+XAt+E6BI+TLItNqcCp5ZQxxNtHX5Ap7Km sDmCAsHBpG45iiBMPZGnt5HGDlf1mPOTTq1UpAQ1xnDs8fkWEySvBNl6orb011BD4vnyjGkHTXA hcPAWW0ZOx65pm+HVdJ5fCtOyNWra+Bjb X-Google-Smtp-Source: AGHT+IGKD/TWAlzjbeuhZ9Qpow383r2ae5Q4p/ZxENXpuYE9xocO5qoefIeXVZaNPjwzyiW/ba2hbLePAMAeL4xGirs= X-Received: by 2002:a05:6214:1783:b0:698:f87e:9dfb with SMTP id ct3-20020a056214178300b00698f87e9dfbmr9029892qvb.50.1712083936135; Tue, 02 Apr 2024 11:52:16 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <1a4a44c5-d4f5-40ca-b3dc-13d64c2b4425@app.fastmail.com> In-Reply-To: Date: Tue, 2 Apr 2024 20:51:49 +0200 Message-ID: Subject: Re: [PHP-DEV] [RFC][Concept] Data classes (a.k.a. structs) Cc: php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: weirdan@gmail.com (Bruce Weirdan) On Tue, Apr 2, 2024 at 8:05=E2=80=AFPM Ilija Tovilo wrote: > Equality for data objects is based on data, rather than the object > handle. I believe equality should always consider the type of the object. ```php new Problem(size:'big') =3D=3D=3D new Universe(size:'big') && new Problem(size:'big') =3D=3D=3D new Shoe(size:'big'); ``` If the above can ever be true then I'm not sure how big is the problem (but probably very big). Also see the examples of non-comparable ids - `new CompanyId(1)` should not be equal to `new PersonId(1)` And I'd find it very confusing if the following crashed ```php function f(Universe $_u): void {} $universe =3D new Universe(size:'big'); $shoe =3D new Shoe(size:'big); if ($shoe =3D=3D=3D $universe) { f($shoe); // shoe is *identical* to the universe, so it should be accepted wherever the universe is } ``` --=20 Best regards, Bruce Weirdan mailto:weirdan@gmai= l.com