Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114806 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 45248 invoked from network); 10 Jun 2021 06:21:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Jun 2021 06:21:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2AA31180507 for ; Wed, 9 Jun 2021 23:36:34 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.42]) (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 ; Wed, 9 Jun 2021 23:36:33 -0700 (PDT) Received: by mail-ot1-f42.google.com with SMTP id 66-20020a9d02c80000b02903615edf7c1aso26444347otl.13 for ; Wed, 09 Jun 2021 23:36:33 -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=E1/oA3UQO/qYQfjPinxE3DNi6pCbOn/kjlTL7lgec14=; b=O2O5cKLFIVbQX396vAV8sxpEQK8/CtPsKcvoKmvmYZREMRN3s9BQzD/xfAA1Zq8J34 yROOJ5iU+X9O9/vLSf6m++5P7yvCfU3SUBAwzo4i+fmly8FvhZdDEBAd4WwrsQy6b5nx BQeCUZmzgqSwtVELd1863KnDUXsjG/ZA7ggK+kKl0A9IBCX4Z0eD/OrvH212qLBbQreZ FpDn8qULo7iRr3pedvhIvyfgSgr1Jj8Jg7QfEQTBjh4t/9/q1+FtkdsTx84vCxT51QFd lizx8Al1yDeltTgeAz/Z6D8bL7tnPQgt+mt7XE95wKWLH/MsxzHi2DtzmWyqqa1ojrn0 /FMw== 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=E1/oA3UQO/qYQfjPinxE3DNi6pCbOn/kjlTL7lgec14=; b=N35Lum+qfeRBUscO5fk5GthaPzlsDOzEgdU76tVh+XH0DZfQqQMWdN1R7c7tZtrHHX lE3RnI6nXZxSb9hRUhEVHnQyIfwslODMwFuOFf+TqUukWRQfptlVn8g7fVmGsMOL5AyY JdHQyCT3wRT0mmV6ZGYU6+agvTIWrlPhou19ordN+FyxDa2ZxGA0fEHpUD1Lxfi1fEVa 1PzbSivkZ+O8+HtEWZW+uBrJQCGyfH0daGIKerc/TrJHAnREdEvGVn5xpr4UsJ4J+atO 6SUfDOIf2k1Cbm35Cc9FF8x9fU86jfl2pNsXEur6xYw7LO3gzNBYb9B9DhG0ENjgoZeu JQYg== X-Gm-Message-State: AOAM53147wADb7MyJXOGvChIxuikTcBsBDK+2M++M6D04S0eAP/Gy53j Jz9Ka65N1sw+Pqpvq8mnzjJernVPC9UM6W5jfHY= X-Google-Smtp-Source: ABdhPJzK5wHfWCl9+8QO+nXfBuFk6GRdZvQxMoAVU+MG4EDMUpsp6Dx3rcTKPIlgbegUfHJV1+wTplggeDPzw2YOnzw= X-Received: by 2002:a05:6830:1bf7:: with SMTP id k23mr1184747otb.206.1623306992995; Wed, 09 Jun 2021 23:36:32 -0700 (PDT) MIME-Version: 1.0 References: <7a40dd68-6e44-4b2a-83e2-956fe00c9e6e@www.fastmail.com> <81EDBC9A-D6C7-451A-8B77-7EE61D1580A5@newclarity.net> In-Reply-To: <81EDBC9A-D6C7-451A-8B77-7EE61D1580A5@newclarity.net> Date: Thu, 10 Jun 2021 13:36:20 +0700 Message-ID: To: Mike Schinkel Cc: Larry Garfield , Nikita Popov , php internals Content-Type: multipart/alternative; boundary="000000000000add24d05c4639cf8" Subject: Re: [PHP-DEV] [RFC] Readonly properties From: pierre.php@gmail.com (Pierre Joye) --000000000000add24d05c4639cf8 Content-Type: text/plain; charset="UTF-8" On Thu, Jun 10, 2021 at 11:08 AM Mike Schinkel wrote: > > Hi Larry, > > Thanks for the response. > > > On Jun 9, 2021, at 12:51 PM, Larry Garfield wrote: > > > > Pierre and Mike: > > > > "Asymmetric visibility" as we keep referring to it would mean the "implicit accessors only" version of this: https://wiki.php.net/rfc/property_accessors > > > > That is, it would let you define public/private/protected for get and set operations on a property separately from each other. > > > > There are three key differences between readonly and asymmetric visibility as described there: > > > > * Asymmetric visibility would allow a property to be reassigned multiple times from within a class, readonly would allow writing to it only once when it's uninitialized. Whether one of those is too-tight or too-loose is a matter of opinion and context. > > When I read your statement I first thought you were wrong, but then I re-read Nikitia's RFC[1] and realized that RFC stated the properties of an object assigned to a readonly property *could* be updated, but *not* the readonly property itself. That's not related but an assignment by "reference" consequence. I think :) > > I wonder if I was the only one who read that mistakenly? > > Anyway, have either you or Nikita considered making a distinction between 'public readonly' and 'private readonly' such that one could disallow any changes after initialization and the other could allow changes but only within the class? Better formulated than I tried :) I would like to have the readonly keyword to make a property readonly outside the class but read/write inside the class, together with visibility it should cover pretty much all cases (parent class included). Init only could be a separate keyword (allows init only, inside the class or outside the class being defined by the property visibility attributes, protected, private or public). I think users, and myself first when I read it, will have a hard time translating "asymmetric...." part of this whole thing (as in, if one has to go to wikipedia to understand what something does instead of what it looks like ;) ). best, -- Pierre @pierrejoye --000000000000add24d05c4639cf8--