Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126048 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 245381A00BD for ; Sun, 24 Nov 2024 21:48:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1732484691; bh=FmbEJiVTRnptES064aa0rDXz2Z5qwKfhjexV+rPdGU0=; h=Date:From:To:In-Reply-To:References:Subject:From; b=J1dFwcFFXUn2QRs+4ACioVLkmGTQEVgdzyLc18LUMhKm264AdurOagBcOzv6dvkGq EdHqRAKGlgLNruuKEydzh5bBDjzqWjXjE1IhHezV/c63SqFRKcm7OYzxdA79goc35L 0G8RCN6RQKeOoTVNZOCOew3C20usVgNrQOleAAjxmpg9rU/mv1KjMI8ChEsWzKzDR9 qk/HcmeOWrm3r8Vd9+z1lQkLnXTn449vetbPYijGqcXtZIeiTJC1J8/9fiHFJ/0LFJ LpzDPZLz5kpKe0MHRIVfzDU2VOiQHJKrlFmltjt7b7JFBCEcSJUNC1EoUvXk2vnXmd EaaVIZtkGkzXw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A0D9C18057E for ; Sun, 24 Nov 2024 21:44:50 +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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fout-b4-smtp.messagingengine.com (fout-b4-smtp.messagingengine.com [202.12.124.147]) (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 ; Sun, 24 Nov 2024 21:44:50 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.stl.internal (Postfix) with ESMTP id B864E114016C for ; Sun, 24 Nov 2024 16:48:00 -0500 (EST) Received: from phl-imap-06 ([10.202.2.83]) by phl-compute-01.internal (MEProxy); Sun, 24 Nov 2024 16:48:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm1; t=1732484880; x=1732571280; bh=JsxcmK+bwHuENCN378Lmj 4zva/3tu+dhXhimdCpxtMk=; b=BtmdiYLoPy02MXaD34lIu3PWBQAx+5LnRW67B //3fNXjpZV6F9qkeX+Op7hDldrWNroF0eP3GQNW6AuaPEQqS7rTCuAvkG9GKCqVW jdggDrR0rgCHO9Yq+YhFSMqzKREd56XLDLkTSxVu1vOYnC3hKQVd1Nxatyms3sLb NqhPfx2MNvDgrtngMNXCgl+d0jaHCX68wrxAHTj38ulzOfhyu+VrcRqScn/JaRE7 ikUiPouLeZTBRXL7gnmLKYWiz+DOoLDgGpUT1sYnoKtr8Tf9k7QDTe+hs6mCksan kwyNV5JRFvi78dlAosAEZb/bMhAAzvKHvzvCV24fQWVwP+NeQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1732484880; x=1732571280; bh=J sxcmK+bwHuENCN378Lmj4zva/3tu+dhXhimdCpxtMk=; b=m/SU9gzFApnB4VBpP 85v4QsX2SDsi0IjZblseqg/XzmmvjQXo4aarToUKtXQ1+sYSBaFP/kCV/Lq9upe4 NjPnsUXxY4FeLuDqjXVdXVI8cbtBHhK+XlQ+EeS1bfjWldRbOfVadWeHDPo0TUIL U37YxyHUHDcpexT2ytQ5G/lmFQYRfcMl1EtsKQSeUADKl8vGwVmD30Mr9Xm8V3zu +Mgdu236OpEmSownwHIunv/bw6in7JEK7r5k0QucoWl6sTbyBfMrIJZZmuDT+czf +YsD3yxuHKwM1X4bHq9SF2/uAsR/iuEFrM9d6QvDuO+vXU9y2MsxAFP6o6La3rkQ 5pyew== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrgeefgdduhedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnegoufhushhpvggtthffohhmrghinhculdegledmnecujfgurhep ofggfffhvffkjghfufgtgfesthejredtredttdenucfhrhhomhepfdfnrghrrhihucfirg hrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqeenucgg tffrrghtthgvrhhnpeelvdefkeefveeikeeuleekvddvleevuedtgeeiieehuefggefftd ekveeiheegtdenucffohhmrghinhepfehvgehlrdhorhhgnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguth gvtghhrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgt phhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 4DB4C29C006F; Sun, 24 Nov 2024 16:48:00 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Sun, 24 Nov 2024 15:47:28 -0600 To: "php internals" Message-ID: <953119a4-39fe-4054-a72d-64f71052c191@app.fastmail.com> In-Reply-To: <7c82a45e-6516-4bcf-a00f-3d994d4be2f4@rwec.co.uk> References: <18b85ba5-5f1c-489c-9096-3ae203977fbe@app.fastmail.com> <66b25296-ca81-4029-b6f6-064cfd810635@app.fastmail.com> <7c82a45e-6516-4bcf-a00f-3d994d4be2f4@rwec.co.uk> Subject: Re: [PHP-DEV] [RFC] Data Classes Content-Type: text/plain Content-Transfer-Encoding: 7bit From: larry@garfieldtech.com ("Larry Garfield") On Sun, Nov 24, 2024, at 8:38 AM, Rowan Tommins [IMSoP] wrote: > Hi Larry, > > I think that's a useful breakdown of the concepts involved. I don't > think it's a bad thing to have a feature that covers multiple of them - > common cases shouldn't need a long string of modifiers like "immutable > copyonwrite valueequality class Point { ... }" - but being explicit > about what we are and are not including is wise. > > There is one point I'd like to nitpick on, though: > > > On 23/11/2024 20:35, Larry Garfield wrote: >> 3. Physical equality. This is what === does, and checks that two variables refer to the same memory location. Physical equality implies logical equality, but not vice versa. > > > PHP's === operator is not, in general, an identity operator; it is a > "strict equality" operator, whose exact meaning depends on the type of > its operands. > > For "scalar" types, it checks the concrete type and the value: 1+1 === > 2, and strtoupper('hello') === 'HELLO' > > For arrays, the definition is applied recursively: two arrays are > loosely equal if all their elements are loosely equal, and strictly > equal if all their elements are strictly equal. > > Objects are really the outlier, overloading the operator to mean > "identity" rather than applying a strict value comparison. > > Example: https://3v4l.org/udOoU > > If we introduce some new "value type", it seems very reasonable to use > the same recursive definition of strict equality used for arrays. > > > -- > Rowan Tommins > [IMSoP] Valid point, thank you. Though I'm still not convinced that value object equality behaving differently from normal object equality is going to be self-evident or intuitive. Either way, my core point still stands: Give me a way to directly control how equality works per-class, like most of our sibling languages do, and we're all set. Problem solved. --Larry Garfield