Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119006 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 54932 invoked from network); 14 Nov 2022 20:03:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Nov 2022 20:03:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 591A218004D for ; Mon, 14 Nov 2022 12:03:08 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 14 Nov 2022 12:03:07 -0800 (PST) Received: by mail-ed1-f48.google.com with SMTP id a5so18872177edb.11 for ; Mon, 14 Nov 2022 12:03:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=nVpXZJXBZMNy99t0zBNODEBRACZurYRPz8AsusUS7rE=; b=RTSi22TgW8cwfg0n/ZIS98eREDyJk2Mt7SDUD8mvD7P8gOSB1cMnmO/F1G9LpnIj26 Le73SP1T6CXp8qLHSsbarPImhWPkCvccw5u3KT1rPx7sgOoZVa4CTu2STS7SA5AbXeI0 8HC6StTzrVVnxLlMhz4rXo6+zOafDkEarYJZxXfRddb3EeuZMjzKttIFVQs91VmpZc+5 HDehAYXG9d11K0dfeiE+iSvvUAQg2JYTI5co0V6AEFSCYua1ZwZfs50ujn58s3e55av4 CwKnj/X7rzfrouQT66HRGZ1/+k9VTIXEhjLMQOAMm2JGcnqgW9HtnGN42jhxUQcVHm81 UuYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nVpXZJXBZMNy99t0zBNODEBRACZurYRPz8AsusUS7rE=; b=k0y9xBIe5mmtQs0pVeG9eKLtROrBL1gLYeJx0YorbmMBkcpym8UqXAZUYd8UOQC2F3 oz9eYCHgqgmJG8n0O+zjapKVpt0r1dXuWfXMirmHlDBMleYHDU9FRkFnF8x1ws/Uny13 ySBVowUuLtzp4yE+h6qlRrKDCn9b4dNPHYO+/5dCNuP8yC0mXdhNQ7DVP8Jg/6aEMi1I DX5b6Oc1lBKUClPLJ69OKFCH1cc9Wa/1+LWSqTxjg9hT7hb88P3mkcSrrQ+uLqbY6to9 EKl3zFYhNbJo2eeNGmV63ZbDHZ367Dd4uHyA5bat/zd1Mlpol3Hmb7a3aWsJ7LXY4Uou DU6g== X-Gm-Message-State: ANoB5pkzEE4oN8R0B3uk3nMktq5yaFQUl5pmoAsSyTAdMsvQcca7reZu dAGkeyHOkpbDgPlmKjX717ptu9qjiTk= X-Google-Smtp-Source: AA0mqf7Mzy09kTomT83xQiJsH0JL7JwB3/taID3SJOpHO8Z3ltOGAnCH8PsejeKJ3APvZS9qxcjhDg== X-Received: by 2002:aa7:cd67:0:b0:464:b8b:f594 with SMTP id ca7-20020aa7cd67000000b004640b8bf594mr12282094edb.407.1668456186487; Mon, 14 Nov 2022 12:03:06 -0800 (PST) Received: from [172.20.10.2] (202.233.197.178.dynamic.wless.lssmb00p-cgnat.res.cust.swisscom.ch. [178.197.233.202]) by smtp.gmail.com with ESMTPSA id qo14-20020a170907874e00b007a03313a78esm4600055ejc.20.2022.11.14.12.03.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Nov 2022 12:03:06 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) In-Reply-To: <9AB678BC-ACF1-47F0-92A2-6F47AA1CEDBE@gmail.com> Date: Mon, 14 Nov 2022 21:02:50 +0100 Cc: php internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <0854b030-c51c-4c1b-a7dd-22835a1e5da9@app.fastmail.com> <9AB678BC-ACF1-47F0-92A2-6F47AA1CEDBE@gmail.com> To: Larry Garfield X-Mailer: Apple Mail (2.3608.120.23.2.7) Subject: Re: [PHP-DEV] [RFC] Asymmetric Visibility, with readonly From: claude.pache@gmail.com (Claude Pache) >>=20 >> 1. Relax the set-is-tighter restriction. That would allow `protected = protected(set)` etc. on any property. It wouldn't be particularly = useful unless readonly is being used, but it would be syntactically = legal and behave as you'd expect. We could still disallow "set is more = permissive" combinations (eg, `private public(set)`), as those have no = apparent use case. >=20 > I think that Option 1 is the most reasonable. The meaning of `public = public(set)` and `protected protected(set)` is straightforward; from a = user point-of-view, disallowing them seems more like =E2=80=9Cit is = useless=E2=80=9D than =E2=80=9Cit is confusing=E2=80=9D. Unless there = are good technical reason to restrict it, we can just leave to linting = tools the care of reporting it. >=20 > =E2=80=94Claude >=20 To clarify my position: * The set visibility must be either more restrictive or of the same = restriction level than the get visibility. * When the set visibility is absent, it is inferred as following: * If `readonly` is present, the set visibility is `private` (as of = today); * otherwise, the set visibility is the same as the get visibility = (again, as of today). * We don=E2=80=99t judge whether it is reasonable to write `protected = protected(set) string $foo;` when you could just write `protected string = $foo` for the same effect. Similarly, we don=E2=80=99t judge whether it = is reasonable to write `public function()` when you could just write = `function()` for the same effect. We leave it to coding styles and = linters to decide whether the short form or the long form is preferred. =E2=80=94Claude