Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115258 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 72200 invoked from network); 1 Jul 2021 14:29:27 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Jul 2021 14:29:27 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 27853180508 for ; Thu, 1 Jul 2021 07:49:58 -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.5 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, SPF_HELO_NONE,SPF_NONE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from processus.org (ns366368.ip-94-23-14.eu [94.23.14.201]) (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 ; Thu, 1 Jul 2021 07:49:57 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by processus.org (Postfix) with ESMTPA id 39F735101324 for ; Thu, 1 Jul 2021 14:49:55 +0000 (UTC) To: internals@lists.php.net References: Message-ID: Date: Thu, 1 Jul 2021 16:49:53 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Authentication-Results: processus.org; auth=pass smtp.auth=pierre-php@processus.org smtp.mailfrom=pierre-php@processus.org X-Spamd-Bar: / Subject: Re: [PHP-DEV] [VOTE] Readonly properties From: pierre-php@processus.org (Pierre) Le 01/07/2021 à 16:38, Nicolas Grekas a écrit : > Hi NIkita, > > I voted against the proposal because it doesn't work with cloning at all. > > Cloning is a critical feature of stateful objects, and we should solve it > the same version that introduces readonly IMHO. > > If we figure out that we can't agree on a sensible improved behavior for > cloning, we're going to be in a dead-end with readonly. > I respectfully disagree. Having readonly properties and immutable objects is a must have, but changing property of an object while cloning, not so much. There's many case where readonly properties will be valuable where you never need to clone your objects. Actually, cloning objects is not something you do every day. Please note that I agree with you that advanced / flexible clone semantics would be a nice to have, but I don't see the lack of it blocking for readonly properties. I personally don't have any real use case where I couldn't implement withers on my objects doing the same than dedicated advanced clone semantics. Could you please provide some real world examples ? People could change their minds if they could see why it's so blocking for you. Regards, -- Pierre