Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115186 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 16678 invoked from network); 28 Jun 2021 18:17:11 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Jun 2021 18:17:11 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 135D81804B0 for ; Mon, 28 Jun 2021 11:37:00 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,FREEMAIL_REPLY, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 28 Jun 2021 11:36:59 -0700 (PDT) Received: by mail-ej1-f52.google.com with SMTP id b2so269181ejg.8 for ; Mon, 28 Jun 2021 11:36:59 -0700 (PDT) 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=dZZmbawZswAq92LtL4zePSkl8yDL9TCtnComcnHw5H4=; b=qTqQ58IMI5E/qGqOBZoPr87eF0rLELd+ON4028R8BJl+jhB70nMR64C3e4UL9CE8oe BNio+MfL9pintgSirlHcs2/mVLXtzFR+5x1sH6YEEDtN32kpg+i8DLtMtzPTv2IXoFrX k7FMBGKsHsgckQzyng1XqqzjkfubPfd45DGlKxisfUU1DymkCmeIc4C/BBbxzbVS6po+ MHgbtt+U7LhyKl0003buQaupJUMui5V+qyU/TXJH+hafvYyAc0wrYdTVEaXDWaeMBxwV fdrwwN0SJrX2fEX1XA9j6ZpNYYWA93h0hSthhFinP8G2b1sPnkrYktzbGIJdPIjhhl3D r8wQ== 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=dZZmbawZswAq92LtL4zePSkl8yDL9TCtnComcnHw5H4=; b=GH8loMYcyfK8kBEzq95ZBmWHPIypEdAn+cvjYuA/ZurwLT9XnMA5N3cepFTX1bZpEl Pw4QoUcaWHuvnh3xXXD6rCDqFDzV4TaRhGykiUx/4DUBQMM6XmhEr9DVAcpTcVn6CTnM dFkZRoZXJZfY6h9vU+2Hl5GjbA6QQJ6Ym/DD1ZtHjDmsEwezF0e1pum8Zh7mjopaqili a8shghzEXJCwXcRebGuIn6iSWybwLib/97BCSD1PPzrdpV9lKd4AG1wBhzQXYOhBEiSB +iCeMMwj5DtissYviuE7yarp+y4Joq+FHiBYatkotJLSHbs4lLglhPu422RkpRCY1rtK MGdw== X-Gm-Message-State: AOAM532eGvx0/glrYBhgAke3+gNSn7OFAEGemJuD04eYV4ZAJt2rleJZ m/AJRxSgHCo84FiZOcdWmVCsZMLmJXa84gnK4JdN6BnX X-Google-Smtp-Source: ABdhPJziIqnGqCr4ei0XFnusnXDqMCDennR+QeR8NoqDngzC8vcqz4THibUz/S+13rwJkxilvtdSKoSyaHENNGFLPZQ= X-Received: by 2002:a17:906:4fc7:: with SMTP id i7mr25829037ejw.46.1624905415157; Mon, 28 Jun 2021 11:36:55 -0700 (PDT) MIME-Version: 1.0 References: <24af2d01-4f6c-4389-a35a-dab50c0b5e66@www.fastmail.com> In-Reply-To: Date: Mon, 28 Jun 2021 20:36:42 +0200 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="000000000000106b6805c5d7c6d3" Subject: Re: [PHP-DEV] Re: [RFC] Readonly properties From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000106b6805c5d7c6d3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Le lun. 28 juin 2021 =C3=A0 20:30, Nicolas Grekas a =C3=A9crit : > > > Le lun. 28 juin 2021 =C3=A0 18:22, Larry Garfield a > =C3=A9crit : > >> On Mon, Jun 28, 2021, at 11:17 AM, Nicolas Grekas wrote: >> > > > I'd like to open the discussion on readonly properties: >> > > > https://wiki.php.net/rfc/readonly_properties_v2 >> > > > >> > > > This proposal is similar to the >> > > > https://wiki.php.net/rfc/write_once_properties RFC that has been >> > > declined >> > > > previously. One significant difference is that the new RFC limits >> the >> > > scope >> > > > of initializing assignments. I think a key mistake of the previous >> RFC >> > > was >> > > > the confusing "write-once" framing, which is both technically >> correct and >> > > > quite irrelevant. >> > > > >> > > > Please see the rationale section ( >> > > > https://wiki.php.net/rfc/readonly_properties_v2#rationale) for how >> this >> > > > proposal relates to other RFCs and alternatives. >> > > > >> > > >> > > I plan to open voting on this RFC soon. I don't think there's anythi= ng >> > > technical left to address here, the discussion mostly comes down to = a >> value >> > > judgement. I think everyone has made their position regarding that >> clear... >> > > >> > >> > Actually, we talked off the list about a way to possibly make this wor= k >> > with __clone(): >> > >> > We could allow __clone to have one argument, the object being cloned. >> And >> > when the signature declares this argument, then all readonly propertie= s >> > would be set as uninitialized on $this. >> > >> > A typical __clone function would look like this with readonly >> properties: >> > function __clone(object $original) >> > { >> > $this->readonlyProp =3D clone $original->readonlyProp; >> > } >> > >> > That would turn my vote into a +1 if that could be made to work! >> >> That sounds like it would support deep cloning, but not with-er methods. >> There's no way to provide a changed value. It also would mean a lot of >> work on larger objects to transfer across all the properties. I don't >> really see what this would add. >> > > Can you elaborate about the lack of support for withers? Having some work > to do doesn't look like an issue to me, especially when there is no > alternative to compare that too. > I sent that too fast, I agree about withers... :) I'm looking for a way to +1 that RFC... Any other idea? --000000000000106b6805c5d7c6d3--