Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124356 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 DD7641A00B7 for ; Wed, 10 Jul 2024 17:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1720632972; bh=k3DwBKorEeren5AlJ6WNHPPtzaffh9qZVcVFtUfELWk=; h=Date:From:To:Subject:From; b=FB5Q8HU9CJYeOFqpNvei4f95j+B0ligoL8lao8wgan6zLUq2YrS+m38iw5HtIG0Gk EbXNNK8fo0KI2rvMcjR3+1jLDtbBIIC2tWLTachnbR91itLUcRADN6keVx/2ctLExP 1tWjKDXHoZsiLcOR0oCss+YfkhInru65R4GDnt02qCFzX6mcVCkP6LYeS07iK47Wzu k8SDMFlec0rgztur7Esc9FFNOg95j46/0P07t+DqxF9wheyEm0N8ea8xgkgM5BJPcj SZzRqgEsd4Sfib1z+uqYs1/ipujg0uZpySINmyNz6mdTLEdqwoEmSqbmNWAeFGQhKK XXGBBthOV1z5w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9AC71180003 for ; Wed, 10 Jul 2024 17:36:11 +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,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh6-smtp.messagingengine.com (fhigh6-smtp.messagingengine.com [103.168.172.157]) (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 ; Wed, 10 Jul 2024 17:36:10 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 858AB1140BB9 for ; Wed, 10 Jul 2024 13:34:44 -0400 (EDT) Received: from imap49 ([10.202.2.99]) by compute1.internal (MEProxy); Wed, 10 Jul 2024 13:34:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm3; t=1720632884; x=1720719284; bh=k3DwBKorEeren5AlJ6WNHPPtzaffh9qZ VcVFtUfELWk=; b=B1fBEY8qz1acEH+ExrxlAn+t2cyvTIRTbuXWIegpItvEkMce x8L2Vgx9tXfNGPglTGIABvGx8tj40M/1R1GFkYf3nFX/7WKqBKJX6g2tgAXKD1mJ pjZb1vM4VjYQMqJEi6r7GMiX8NI7WZdxS+GpWWu2+qVRYh3rmuiTpm788HVc8IBc C4U8EfBJfawT+le8/u++Q/bNL4VoVFK3+TTrcZPiw2Wr8Xxan3eONulYuxP4y/W/ ee1IdxpFWxWv5IHE0BjgFCrWmrjRzBkqgpFr8cWxP6HJ4kv1eIKnzhcD8SiVd6+y eqPSVWb5VltK8uHMjTZWq9k+lgvSbDhYtXXl+w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1720632884; x=1720719284; bh=k3DwBKorEeren5AlJ6WNHPPtzaffh9qZVcV FtUfELWk=; b=V/vOAvXIuzgrIf6efKiCRGB6TBJ3/A13XVAcGJmH5ZS5Co7r6sF evQuaZm+BP6SmFbNHf58kf9txxMxuy4+vdOH9PN1ccUcM81RXDjXTzg3NPiAFUoD O3jnu7afov430mrzz1Zun0H9BTuIshqSUD2qXJRQXpndEhcDVchnQdTqy79KzVHr Fm6YWQ33+vIfi6GR3VB4AA5K/JSfgwLHbUDdfWQIQGT8r3kB54JBqD76+QNTwsUG fJABIO1zNukA7M2HWbangw3xxJ5cfoz4vrhlr1nbKp0V7XR1fA0wpaqONTv5PR4G 0DjtnexDUZD142O1GstjwZjzJsRF5w6Cung== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrfedvgdehfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkfffhvffutgesrgdtreerre erjeenucfhrhhomhepfdftohgsucfnrghnuggvrhhsfdcuoehrohgssegsohhtthhlvggu rdgtohguvghsqeenucggtffrrghtthgvrhhnpeefvdelteeiudejheejgedvhfffveeike evfffhffefgfeikeffheevkeejiefghfenucevlhhushhtvghrufhiiigvpedtnecurfgr rhgrmhepmhgrihhlfhhrohhmpehrohgssegsohhtthhlvggurdgtohguvghs X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 3469E15A0093; Wed, 10 Jul 2024 13:34:44 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-568-g843fbadbe-fm-20240701.003-g843fbadb Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: <14b769e9-acb7-46d2-85ab-f276e82f3069@app.fastmail.com> Date: Wed, 10 Jul 2024 19:34:23 +0200 To: internals@lists.php.net Subject: [PHP-DEV] [low priority] WeakMaps with scalar keys Content-Type: multipart/alternative; boundary=e4df34a2a70c4efab15e2027d551770e From: rob@bottled.codes ("Rob Landers") --e4df34a2a70c4efab15e2027d551770e Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello internals, I know now that some of you are swamped getting ready for 8.4, so I want= to be clear that this will be an 8.5+ thing. I am simply sending it to = the list in case anyone wants to discuss it, burn it with fire, give it = a gold star, or ignore until later. Currently, a WeakMap may only have object keys, and this logically makes= a lot of sense. However, there are cases where you want to reference an= object by a value but if the value is no longer referenced, no longer n= eed it. A good example of this might be used in dependency injection con= tainers, lookup tables for value objects, etc. I'd like to propose a ReverseWeakMap where the keys must be scalar, and = given an object as the value. Once the value is no longer referenced, th= e key and value is removed from the ReverseWeakMap. =E2=80=94 Rob --e4df34a2a70c4efab15e2027d551770e Content-Type: text/html;charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hello inte= rnals,

I know now that some of you are swam= ped getting ready for 8.4, so I want to be clear that this will be an 8.= 5+ thing. I am simply sending it to the list in case anyone wants to dis= cuss it, burn it with fire, give it a gold star, or ignore until later.<= br>

Currently, a WeakMap may only have object k= eys, and this logically makes a lot of sense. However, there are cases w= here you want to reference an object by a value but if the value is no l= onger referenced, no longer need it. A good example of this might be use= d in dependency injection containers, lookup tables for value objects, e= tc.

I'd like to propose a ReverseWeakMap wh= ere the keys must be scalar, and given an object as the value. Once the = value is no longer referenced, the key and value is removed from the Rev= erseWeakMap.

=E2=80=94 = Rob
--e4df34a2a70c4efab15e2027d551770e--