Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102118 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59775 invoked from network); 18 May 2018 11:59:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 May 2018 11:59:04 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.51 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.51 mail-wm0-f51.google.com Received: from [74.125.82.51] ([74.125.82.51:37952] helo=mail-wm0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FB/02-13666-700CEFA5 for ; Fri, 18 May 2018 07:59:04 -0400 Received: by mail-wm0-f51.google.com with SMTP id m129-v6so14634352wmb.3 for ; Fri, 18 May 2018 04:59:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:cc:from:message-id; bh=VPhiSkoUXOFAPf/tXCr9b3T4siPTI8OXFThpTHuaOuQ=; b=NRyfJKh53TvQSKWpKhoIybzl6TnXaDTABXC5OBzkKK5OWILdMmKLNFK9S4GkHz9r9N kBxIxB/TaThPc27Y+boKjlJF7Bv5/wpmqWUS8DvQdNNOhK+l+qNcb4HRwBuguqK4yyRh rEqTRZTITfn4MDgKbfGBF7Ql2xxSTodRrFHeYny/XZy8mWD4hj5d8c3F5COq78k/gJuE r8lA0FKFOcX7ECYyvNXtnG3LNqOtadniwzvf6u30PVak4hcAwADmYWbMJ/pSq5afxu2H 9oh74Q07mnk6/PrUmAq+yrzhCKrkbWdlb7HCvs8qvT8mVID+3emK+ji74EgHmv8RzAEO mSYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:cc:from:message-id; bh=VPhiSkoUXOFAPf/tXCr9b3T4siPTI8OXFThpTHuaOuQ=; b=BJrohmD9sTc53ZupNdaeG2J6vNBt+z05lJ6/Xui4PeGGGzqN+WTgwuFiaW4Vp9XpPJ vHxmsGUdxVC0atzTl63Lzf4sfv+2aixuuiNSZs1OtLZNtmaXwxwHVQNNJSSRub9Gr9Xp 3WpCD9BKb+kg5eJDW74EKitJ9MVRA++xPVoJGSxqNygFx04OgRBqpsNhPumh5erNFlml WuhWlimaf4rmsrbxpm02n0Hv0vq7Zn1U31JwG1LGi7BdbkAORoQeyEd9+6alpPyzgaA+ M21OBNr9sUu1IDo6xrYKAQVE9uInzB976lGH0T2+JfmrTYaIYpCy4klJDeB1GSjsnpDn 9cxg== X-Gm-Message-State: ALKqPwePrsSziGMTOnlczqymaBHPwTN/8hQrfHkDuVFS5YwHQTeUsq5G aFaAP3wxMKSoU931gyv5l4Ag6aQs X-Google-Smtp-Source: AB8JxZo3+mFnjMOSc0nAMsYTfHHGeWbV+yrV6AffCWND4UU6XU4vibGBAcTI6E0ABilAYzIulumyEw== X-Received: by 2002:a1c:4294:: with SMTP id k20-v6mr4115406wmi.7.1526644740881; Fri, 18 May 2018 04:59:00 -0700 (PDT) Received: from [10.7.75.30] (188.29.165.249.threembb.co.uk. [188.29.165.249]) by smtp.gmail.com with ESMTPSA id a13-v6sm7174341wrc.19.2018.05.18.04.58.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 May 2018 04:58:59 -0700 (PDT) Date: Fri, 18 May 2018 12:58:51 +0100 User-Agent: K-9 Mail for Android In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable CC: internals Mailing List Message-ID: <47A0DB53-F5B8-4A3E-8288-28154A342ED9@gmail.com> Subject: Re: [PHP-DEV] RFC WeakRefs From: rowan.collins@gmail.com (Rowan Collins) On 17 May 2018 10:35:11 BST, Etienne Kneuss wrote: >That said, if the plan is to subsume pecl-weakref, I suggest we also >reimplement weakmaps, which offer a convenient way of storing >meta/cache >data and is not implementable in userland without trade-offs=2E It looks to me like WeakMap would be fairly trivial to implement in userla= nd as a combination of WeakRef, ArrayAccess, Iterable, and an internal SplO= bjectStorage for the ability to use objects as keys (although I'm not clear= why it uses object keys in the first place)=2E The only part that seems hard to write efficiently is Countable support, s= ince you'd have to iterate the internal hash checking for unset objects=2E = I suppose iteration would also slow down a bit of lots of the references we= re now unset=2E Is that the trade-off you're referring to, that the C imple= mentation has some magic to avoid? Regards, --=20 Rowan Collins [IMSoP]