Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127011 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 8F7641A00BC for ; Tue, 1 Apr 2025 16:13:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1743523837; bh=rFBtWFxbPDAcCaG6UQNRyRkr8LxY1VDrY4Ie/XLtKCA=; h=Date:Subject:To:References:From:In-Reply-To:From; b=BAsqXFTbl6PkWUOE4jvdEIXGxahktOgjqv79rh7QDBRIS6UNhLtxrK6UtruoHtdzP KNbd+trVD/I4UaYM5KjyQNPcKcxtTPtA9A+JwsyGgu8ymCsrNQvvKzXPaXuMwue4UR PqKxPlHWNdCbCAA3no5Mc5fItMJoZqCdoWtJzHZmQgS/CQtPQqGcWQg2tceRq8pk1E bybaG7nEqTjYZcRZbE2kPhOBLsruuaKFrEVzRJ09rfgi5O80i1Ynjhx2FMmPSiHAmY E4F44Ydt68+k1ufY39M+Ho8AH9U+6NPZpk61GHSer9knSmpZTyYWHeZwlGqRyw6uqI IjV/ZGOZcBKBA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B36591801DE for ; Tue, 1 Apr 2025 16:10:35 +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_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 1 Apr 2025 16:10:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1743523980; x=1744128780; i=cmbecker69@gmx.de; bh=2vaYrj2gydcqj5kR5QuqxYVmmZ/rIQ2N0nFz7RoccA8=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To: References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=K8RbSlwuchGZu6it1m+NCg9RiJeWlYmWGxHCqiQOIgkGyD030TiRSVElygB7+oQl 0tdYqpWoSNKMBkBadNUf7OHg0sMQY62bBuHxlqM2e95TMEUJGfWGsgvosCCSJmCB0 pYu7h5muK9acm8dVspgo+mzrCLGg1nYha64jyG3OPXem7cSDn0OZ8p2FvAFZiaTSN GG3/veqTFEo7RQq4OvzzHDKHCW+O0UJEfu3qbGK55lfDoKAxyi84rhAPuitbz7swd HtkIhuoBximD4/0Tg7PybRlK6lWrCdmtjjtwNwxAGcKab8ocUSXlFvHehddHwL9I4 q/y5kmUVzo7jxDBgBA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.2.130] ([79.251.201.250]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MVvL5-1tYX8r1Bwr-00X7eM; Tue, 01 Apr 2025 18:13:00 +0200 Message-ID: <604225b1-b36e-435d-aa96-43b3d6658598@gmx.de> Date: Tue, 1 Apr 2025 18:13:00 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC brainstorm] Approximately equals operator Content-Language: de-DE To: Niels Dossche , PHP internals References: <4a3c6ce7-102d-4cfe-a7a8-35630715b870@gmail.com> In-Reply-To: <4a3c6ce7-102d-4cfe-a7a8-35630715b870@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:uw5y970os4wiVz+PPTbuitvL3gIYIuikv6JBB2tAfnTHY9Bde9N /fKZmuM0/X/rM5Ide6ocgGyOly3ZgQGPCH2q1U4qMJ/DYu+mogVhHyPLGqeOLxcOzg0R2w2 7ZE7JLMd9Igg+74dwBH4wN2186cu954CCh1QWg1ntYeP6x12+VhxFRurrnTIm/CDJBYTZ+D W2pifqvHoWfllcdmJzkCQ== UI-OutboundReport: notjunk:1;M01:P0:ksK9Al5Ax/o=;VHDF8ZC9NuMIHmVdTCGfDr1LAJ7 Myzv25er+9tpImugQudA72iLWT5KMbGWWndQtjrFjTMUx0/OjJV9zvTwACCyXOKIWvdX/oVYw /2i4Nw4VDL3vHf78nwWopHjGzf6ekq/1gr+pJhheXBU2YLHz9J/KXqS1NsnR7bgN7ISxxhvsr gAIoEbsJJzSaebC7Zbc74Y4Mu5Gu0GArVv0JbLAgCxgUm/9FdulpdWV3QH/vqaLXVHmafHbij TOnQYROABhdnvRfBrZqEyiq6vmksANPTLPJmcTxfkGnY96QCdQOJCGa4tC6mkgwDhlA/o4ro4 hMDkFaF4UZEYzSmElvuG8OIvyMbjXAatv8k6j3ViM7fsLEnDx5ZU351RpQCHVsojhNhg4BLNl 1JPqZuWAo5p5rb/nEEhuZHn6mBWAVNvHAequDgnZl1e5fsi1YTKa2y98MX9DzNZ5Y1L55rdYk 6LkDwJK7oOb6Z1y9LsIWSb8WTfbXNlu8e+cvxcNnl+1IViiC5YtMdI+W2pfteM3Dgz5CN0oHM SYhI5xYv8ezp7jGSCbBKyQ6znE2IKi1ZRYWBysDUVY+gLH9AsQLq8wnzsAHEEF8c9+YoQGeHZ W4q42qV4HVmcWdWEEQoMZVLe6u/h9d0h/96TIqQ6JYB0+P2Vqstq0iKTwpsHogYhewo5v4hWu 0nk+ShGgsbWC3wtwC9BiMdB6U3blkRcVg+kioBxTWmD5f/PHy+5vbrCjrHlg6FcAwknRpiNEK 5xE6Ujbp5xQIZPaDIHjFED7SIjhi4/qRMQLM87/usfc9XZx/S6nXSDmV476Ca2Ov7gG6pzY/J 4v26CVo4EDxe5XkPqhCu/fbE6gYm7d/CLJqcnqWcnKvNljJ320Bp8OUvONowdnDT7rjL8ycwI cM8igDZx9b4AK0mPWOpm0KcA6tlYJ5z4sefQymSzacHM+2DqUToylfenmmndNxrjxAKDgHe7K zRD7i9wweqMg9s7lgFeuI9gbOsp5DDYUyGi1l3mKTZBBqygg7+YxD0/4Dk6ZRE9IvD7QBr5QC N9/lTy/zFKNLpC5mx3ciwnrwBuYBuF8WQAkDgtfEftOGXfOt9RnJGIedOokuoo3W8vCrYoXab fJEcikihSpT3buloHTdWRVm33CWmVaXJEwqSqMT6RIkjqf87m5um/VXvUe1CcmXYuD86TShfw Vswfsx00vgp8U7LoFwNLSMpA1j4VQQ88gNdMenGk8V1paRrXaeXkEdSvBrdni8KKpORqjGdP+ v6rwbI2YV4XxRNJ9+6LTGdIZyD3AzzNmSIuY3U9d2LXSS0d5YUDGoF2sHxPhTnVS/1kYZQXww RhqrCAKSYibneGIYAWpvBFH+ViyeBfmyV/NbdcUcYOmZ/UndMxZ+D7tKtW4xCGUKgXEoa/9X/ 2fA554QATTVltf8V/Piv6aOjoJOBhZK5j7yP+mCECXwKjMPZYmEGKMTPWmQaGxEvqNpSVHq7M oNQxr7w== From: cmbecker69@gmx.de ("Christoph M. Becker") On 01.04.2025 at 00:03, Niels Dossche wrote: > We live in an imperfect world, and we often approximate data, but neithe= r `=3D=3D` nor `=3D=3D=3D` are ideal comparison operators to deal with the= se kinds of data. > > Introducing: the "approximately equal" (or "approx-equal") operator `~= =3D` (to immitate the maths symbol =E2=89=83). > This combines the power of type coercion with approximating equality. > Who cares if things are actually equal, close enough amirite? > > First of all, if `$a =3D=3D $b` holds, then `$a ~=3D $b` obviously. > The true power lies where the data is not exactly the same, but "close e= nough"! IMO a step in the right direction, but it doesn't solve the problem that the developer might not even know which equality operator to apply. Thus, I proprose the whatever (?) equality (=3D) is right (->) here (!) operator, e.g. $value1 ?=3D->! $value2 I leave the trivial implementation as exercise to the reader, while I'm porting the even more powerful rmmadwim TCL command[1], which, incidentially, also had been proposed on an April 1st. [1] Christoph