Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109104 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 72006 invoked from network); 17 Mar 2020 15:43:35 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Mar 2020 15:43:35 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1D975180543 for ; Tue, 17 Mar 2020 07:06:16 -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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-vs1-f44.google.com (mail-vs1-f44.google.com [209.85.217.44]) (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 ; Tue, 17 Mar 2020 07:06:15 -0700 (PDT) Received: by mail-vs1-f44.google.com with SMTP id z125so13896441vsb.13 for ; Tue, 17 Mar 2020 07:06:15 -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=epjJ0QQ0pn1KMXtE0uEfpDal9HDC30XMeLOHqUu/mTM=; b=kt8ZDj868DfRJ2dD/4HGHk8ERlNJHjlcx0nfDg3ELb1Js7k65DXMK4uTt7la/q5sGF bv2wKMjdMsMQKu0TCFaYcmBcDFbNmD0mfiyI3ZvMha6VI7jJgxMdx5PDMCaALbmLSiUh hi67yEOVb6sCpBeUwEROn+bMr+fTPdzz77MTRidqGwlfVizM9PBAk4PdRUSmZBOXirAV jv0F3xoQQEgh1xQk8fn2kM7KQEeibmI4KCUHUZcEvclqCYtf6t8iZYuAHx5+xkkeeDCI WCyDNnBIxAfr9pKzWgbFEWwvD1MaZCpEK11ur4Idlt4IEYfp5Qv7RnhTIlluLT2PCtdp M/KA== 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=epjJ0QQ0pn1KMXtE0uEfpDal9HDC30XMeLOHqUu/mTM=; b=gJnTPsWu38aPyhxaa2RBe0ecKMttfJCZWwLIo7zlQ1kzLq+FD3RDuqTrWxcHocbgjI VXsZujFj5XKz0v7003FP1d+iaC70Y0tP5lZsFTFGB1iMQBju1bFkK2rZSItWqw9/B7TW 7sSWX9Fst52We1jZXFvQ3VeaE0fCSRDlT+ipwBeOdYUHq0FoDdKpfNtBc+fV094PgXI1 /xp5rwHkwuLKE6/m6KDdihUD9kjQs5Iq8MAwA0j66gN3oFUGDSHxo185KzMHTydDbwes ZnYHjrIShXSN9v7Ohpm2bjH9DwwcrJjv4V4khKIxUbm3DCAuiqXvi8cHpw6aj7Et2Q9C nhRA== X-Gm-Message-State: ANhLgQ16tuaw7t13cKNkJ2Qq87ZNq6Xa+JQn4OJG/mRRnd8jndg5uaou WMrCMacl6ELJD90a29zqtrg0XsZBYI6mJWeRqWg= X-Google-Smtp-Source: ADFU+vvH7ToDlHh+v2v3BlwnIPRo9LdtTX52topnzaHmqwxDSKpSMK2oHIvVaxZkcSinKdv/uFFJ97AWf/5mTNRohgM= X-Received: by 2002:a67:d03:: with SMTP id 3mr3529886vsn.35.1584453973297; Tue, 17 Mar 2020 07:06:13 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 17 Mar 2020 15:06:01 +0100 Message-ID: To: Nicolas Grekas Cc: PHP Internals List Content-Type: multipart/alternative; boundary="0000000000003dd05505a10d7076" Subject: Re: [PHP-DEV] [RFC] [VOTE] Immutable/final/readonly properties From: kocsismate90@gmail.com (=?UTF-8?B?TcOhdMOpIEtvY3Npcw==?=) --0000000000003dd05505a10d7076 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > I don't think these issues can nor should be figured out later on: they > are low-level conceptual issues IMHO. I don't agree. Initialization would for example 100% work, I only removed it from the proposal at the end because we'll have more freedom to add new language behaviour until we find a much more useful use-case for default values of "write-once" properties than what we currently have. Speaking about cloning: I didn't want to propose a "workaround" in this proposal (as I wrote in the RFC) because tackling that problem in the same time would make the RFC much more complex. And since we can divide the whole problem into two smaller ones (because you can also create a new instance instead of cloning), I chose this approach. I proposed an alternative behavior that removes all the issues. I think it > needs to be discussed more in-depth: > https://externals.io/message/108675#108753 I'd like to reiterate my answer then: I think your idea and my proposal doesn't try to solve the same problem. My goal is to make sure that a property can't be messed with. No matter the scope, no matter if it's some exotic use-case (like calling the constructor twice) or a mistake of the author herself/himself. Your idea would however add a property-accessor-like feature: public readonly $foo =3D> read access from the public scope, write access from everywhere else protected readonly $foo =3D> read access from the public and protected scopes, write access from the private scope It seems to me that it's basically a convention-over-configuration based property-accessor variant where one can't give for example read access to the public scope and write access to only the private scope. And I'm saying that you try to solve a different problem because we have already discussed that property accessors and "write-once" properties are not closely related to each other: While "write-once properties" would solve a problem that is currently not possible to do (immutability of properties), I consider property accessors to be only a syntactic sugar to separate read and write access to a property without using getters and setters - at least it's true for the version you proposed= . Of course, not everyone considers property immutability a problem to be worth to bother about (which I can not relate, but can totally understand), it's also totally ok not to like the special rules I added or the implementation itself, but please don't promote your idea as a better version of "write-once" properties that removes all its issues - simply because it's not an answer to the same problem and in turn has other issues. M=C3=A1t=C3=A9 --0000000000003dd05505a10d7076--