Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104189 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 86287 invoked from network); 5 Feb 2019 19:09:37 -0000 Received: from unknown (HELO mail-it1-f179.google.com) (209.85.166.179) by pb1.pair.com with SMTP; 5 Feb 2019 19:09:37 -0000 Received: by mail-it1-f179.google.com with SMTP id w18so9517934ite.1 for ; Tue, 05 Feb 2019 07:50:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7EwX6bEdPpG2quYF3tdWurWIT1LyUa14hAS2OPU+EHo=; b=ogFxEm6bPuLYVWYEfcwFfASeo+lLLMG0uwZ4FZTSidPy4X4Bbf65EvQhW42rz72B2c j47Mi8ngyn5EteiXkhIqJg9G0u6Mya2glXYuqeueh6J8aqA9M+rqudYIciV6+BJvMHwZ y+RSXPp+LFVAwdfllp5T9Cxmt1YQePLqK87WmyKwhDmbSvcZdPq7yVwyTEFY/fvgvRsR 3HgfKyz2k57tcvjhvQIMzN/3Y9wew93auYNrDpUFfHcBlKzqLkgxELjxwp2Dp74DZPsy pGYeUGKCb85LqLcFISN9KbVytCxQUXQwreUYXMzFL29T2V27ZT/uQ+Ea6wnBxq7hCcNV 1uZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7EwX6bEdPpG2quYF3tdWurWIT1LyUa14hAS2OPU+EHo=; b=N8iwxE7H8R4CDBfRa9XGsgM7Pt8rHGbCpyMd0nlRChkUbKi1MjojvydiHce/PbPyup VX5UTU/VXk22B2KJ/IM0RV6eCtNstjBI0tffhk9J30LUrIIG8ROHgKu/rW2ldipT3oPj PtuaflIBZeHPWnjvoVBYiit8jWThhtpXGEznwbJKTL1VWy+IZLp3iMRwRIczwsjMUmNK e4CuirzMRH/C9LqP8POx7zPt2ELDASrub/3yz7+A/6IBSo/dKTgQV18QWedxZ8aP0B25 Le8GPlYMbs4KEfMrkvcAPqTXTEr61Rz9kDiXn05N0LNYeTK/IZvkko0E3QcIbuqcvBJs TYyQ== X-Gm-Message-State: AHQUAuawYk+wR0Nj3QsJoOXRPES6Rj+SggA5H/qTpQVKnOfjpClXKber J7Xx1x5B842O1eSf2ZhBkneeQID3iMwSywsxt6zWAg== X-Google-Smtp-Source: AHgI3IYyqjVhGHLrmib7fbMsQ0Fcp6EwUpoyDmks+TpBJhry9m2UxBsOxyUL1CxsqH/P/VOakd/e3TrIDsKzse4eQmU= X-Received: by 2002:a5d:88d3:: with SMTP id i19mr710394iol.187.1549381847064; Tue, 05 Feb 2019 07:50:47 -0800 (PST) MIME-Version: 1.0 References: <2fed98af-3831-1a1c-def8-04793fcc0c6f@birkholz.biz> In-Reply-To: <2fed98af-3831-1a1c-def8-04793fcc0c6f@birkholz.biz> Date: Tue, 5 Feb 2019 16:50:29 +0100 Message-ID: To: Dennis Birkholz Cc: Joe Watkins , PHP internals Content-Type: multipart/alternative; boundary="0000000000009da8a9058127920b" Subject: Re: [PHP-DEV] RFC Weakrefs From: nikita.ppv@gmail.com (Nikita Popov) --0000000000009da8a9058127920b Content-Type: text/plain; charset="UTF-8" On Tue, Feb 5, 2019 at 4:11 PM Dennis Birkholz wrote: > Hi Joe, > > On 02.02.19 09:35, Joe Watkins wrote: > > Some time ago I brought this up for discussion, and last night was > reminded > > of it's existence, and so this morning rebased and reworked the patch a > > little based on the feedback I got back then. > > > > Since it was long ago, and there's no particular rush, I don't intend to > > open voting until the current policy adjustment RFC's are resolved, but > > wanted to give everyone a heads up and ask for any feedback you may have > at > > this time. > > thanks for proposing to bring weak references into core, I myself would > have needed them once or twice. > > One point from the RFC bothers me: > > > The proposed API: > > - does not support serialization > > That is a really unfortunate decision, I would really like to have them > serializable. Otherwise if you want to persist a weak ref you always > have to convert them to a real ref before serialization and back > afterwards. I would really like to have this transparency build in. > Would be great if that could be added. > Serialization for weak refs is a bit tricky, and I feel like supporting it could easily become a foot-gun. The fundamental problem is that for serialization to produce a meaningful value, the object referenced by a WeakReference must also be part of the serialized object graph as a strong reference somewhere. Otherwise, the WeakReference will immediately turn into a dud when unserialization ends, because the object it references is no longer live. I think from a technical perspective, supporting serialization should be possible and not overly hard, it's more a question of whether we want to. As another data point, Java does not support serialization for WeakReference. Nikita --0000000000009da8a9058127920b--