Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55333 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22990 invoked from network); 9 Sep 2011 13:49:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Sep 2011 13:49:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=ekneuss@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ekneuss@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.42 as permitted sender) X-PHP-List-Original-Sender: ekneuss@gmail.com X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:52606] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 24/10-21231-6691A6E4 for ; Fri, 09 Sep 2011 09:49:28 -0400 Received: by bkar4 with SMTP id r4so1290862bka.29 for ; Fri, 09 Sep 2011 06:49:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=dAFewqIRsDi49Y0IZvQrv7Nq2NBLR0RHSFn+AcNJ+6A=; b=NY/mmUxRdut7ixnVfXP2MIMgE6CDyeBXfppAaoH4bAtsPhaW/A6wE9ZXFVv5vX4EiY anbb/Cj6XE4GTGZCobErIZOFNXlbr1oVoBNeNUvp+ZdGUU7hVm3+U0GsD1tFcap72+0Y LtxsfY30+ILKERIvEXzzGomWssA6YuB2BdBL8= MIME-Version: 1.0 Received: by 10.204.134.3 with SMTP id h3mr211279bkt.402.1315576162573; Fri, 09 Sep 2011 06:49:22 -0700 (PDT) Sender: ekneuss@gmail.com Received: by 10.204.37.77 with HTTP; Fri, 9 Sep 2011 06:49:22 -0700 (PDT) In-Reply-To: References: <4E39E89F.8060605@sugarcrm.com> <4E3A3643.2070305@toolpark.com> <4E3A4793.2070209@sugarcrm.com> <4E3A91E8.1020107@toolpark.com> <4E3ACA42.8000001@sugarcrm.com> <4E3BF930.9030701@toolpark.com> <4E3C5EDE.3030401@toolpark.com> <4E3D073A.9050709@toolpark.com> <4E412E3E.2@toolpark.com> <4E62443C.9010603@toolpark.com> Date: Fri, 9 Sep 2011 15:49:22 +0200 X-Google-Sender-Auth: 8nOHxkt_7-H8xHFnEhkBKado3Vg Message-ID: To: Nicolas Grekas Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=000e0ce0b1c0d860e104ac827114 Subject: Re: [PHP-DEV] [VOTE] Weak References From: colder@php.net (Etienne Kneuss) --000e0ce0b1c0d860e104ac827114 Content-Type: text/plain; charset=UTF-8 Hi, On Fri, Sep 9, 2011 at 10:14, Nicolas Grekas wrote: > > I don't understand how the code you just gave would be useful in practice? >> > > Is that question for me ? If yes, which code are you talking about ? > > $pseudoWeakMap = array(); > $pseudoWeakMap[spl_object_**hash($obj)] = new WeakReference($obj); > > I've implemented a WeakMap class in the weakref pecl ext, see: >> > > For ref: https://github.com/colder/php-weakref/blob/master/tests/weakmap_001.phpt > > > I believe this better fit people's needs. Or did you have something else in >> mind? > > > Talking for me, that's cool ! > > Just one question about the interface : > Javascript interface is based on a setter/getter rather than any kind of > ArrayAccess. > I could easily create a method alias get/set, if needed. > Does anybody has an idea if on this case, about ArrayAccess vs > setter/getter ? > For example, wouldn't people expect "foreach" to work when $wm[] access is > possible ? > Personally, I like the current syntax, it's short. I'm just wondering of > any corner case exists? > I'll probably make it iterable in the future, yes. Best, > > Nicolas > -- Etienne Kneuss http://www.colder.ch --000e0ce0b1c0d860e104ac827114--