Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119124 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 80291 invoked from network); 13 Dec 2022 15:35:01 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Dec 2022 15:35:01 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 28F47180538 for ; Tue, 13 Dec 2022 07:35:00 -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=-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,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-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (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 ; Tue, 13 Dec 2022 07:34:59 -0800 (PST) Received: by mail-ej1-f50.google.com with SMTP id n20so37467742ejh.0 for ; Tue, 13 Dec 2022 07:34:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=P/scExkmQa2AFdjHCJ4um/QZQ/3FtjewN6QHBCgEqcw=; b=Cr+JGti3AoLRbdBblCCgpkcJwwIX8gFSplOBENpWox6CenrfNYwvvPaChdTc1pXKD7 kx5/9hTRnrRDfwgy1WTu0uqHvQp2o6WkwRewxstjAHjPQEjCxjMxK0IrTRAq6+EkKynK 4wgPBGwRUP7dmE11zJ9jwyq+EUCUWsqGZh4/x4ttHqZgFAT/0O1P1S78qcsNckPiBAMt FhpakpqUoyCE9D7n9DqvXXU1P9FfgKYkt37MmZEJsnaouI9URrxLm0uxHH+5eyp6AdDC hmBQb7QEXcqQaNhks1c0e3scTTfiX+LrHfDhYOuGAAlprT/8VuxDjbJj1ojnTQoJMKKE Ky7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=P/scExkmQa2AFdjHCJ4um/QZQ/3FtjewN6QHBCgEqcw=; b=jPzv87AAWSVvdKF1JRQjDIv8jraZjR4U7dL57VJHuIAu0XajC2QlWvbHr1Vqkc6BjX TrKg4NSLKy8uU65oHUpEEqEW6uOolWUuhsn7vGuom/VHsL+2b/2sQBlWve6M2tA9+DsG Rru8fBIfz+pCYSTv8VTJDptk7oiroTbuqJs4KCayHOSMLmD0aXLnaQKz58eADu6dOfdL jObeVEBWChIYNME0m8OQRJd04jyxvF5xkjTX7ilaxMKhlVBixkDq6tPVtpc+doJh6FsP XD4IvTMh4QrIiQE8dblqcwDnAhfwZ7YNxxmeO/eDotwpLd7qbL9PlPuJDFzzcQupduCu oeBA== X-Gm-Message-State: ANoB5pm2iJyWFAiZtfHm81digI+/thHEdhTXdglJjRoQDKmKMfIaOfvM iO7LeEJV+Hd1bDeJl8JEuaQju6t2gu8= X-Google-Smtp-Source: AA0mqf5Pftenszq1df9T4BuZmp7j86nrtYGbNcbqGRNK6JiQToTJ+lGxG5AQFkYNgnXkCWoEeKY7Ww== X-Received: by 2002:a17:906:f74a:b0:7c1:2d36:d11a with SMTP id jp10-20020a170906f74a00b007c12d36d11amr15955068ejb.11.1670945698206; Tue, 13 Dec 2022 07:34:58 -0800 (PST) Received: from smtpclient.apple ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id o10-20020aa7d3ca000000b004701c6a403asm1340345edr.86.2022.12.13.07.34.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Dec 2022 07:34:57 -0800 (PST) Message-ID: <84647C1B-0F61-41E5-981D-B860BE1E53CB@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_AD616805-7072-4EB6-AE2E-97B13C00FD5C" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Date: Tue, 13 Dec 2022 16:34:56 +0100 In-Reply-To: <8f9cf24c-ee77-4227-9b7c-31c631bf8a72@app.fastmail.com> Cc: php internals To: Larry Garfield References: <0854b030-c51c-4c1b-a7dd-22835a1e5da9@app.fastmail.com> <831b9906-dc0c-420c-b22f-8a0cc8a1ad64@app.fastmail.com> <454c5329-d5a3-5174-d09c-346b7d65435c@bastelstu.be> <8f9cf24c-ee77-4227-9b7c-31c631bf8a72@app.fastmail.com> X-Mailer: Apple Mail (2.3696.120.41.1.1) Subject: Re: [PHP-DEV] [RFC] Asymmetric Visibility, with readonly From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_AD616805-7072-4EB6-AE2E-97B13C00FD5C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 11 d=C3=A9c. 2022 =C3=A0 20:18, Larry Garfield = a =C3=A9crit : >=20 > On Thu, Dec 1, 2022, at 12:31 PM, Tim D=C3=BCsterhus wrote: >> Hi >>=20 >> On 11/29/22 21:29, Larry Garfield wrote: >>> Thank you everyone for the feedback. Based on this thread, we've = made two changes to the RFC: >>>=20 >>> 1. We've moved readonly back to forbidden with a-viz for now. I've = added a section to Future Scope where we really should sort this out in = the future, but we'll do that in the future when we can all focus on the = various nuances of just that piece. >>>=20 >>> 2. I rewrote the section on __set to make it clearer. That also = included Ilija and I digging into all the nuances that are already = present. The text may still look a bit complex, but that's because the = existing logic is already complex with readonly. Long story short, the = a-viz RFC does not change anything in the way __set works vis a vis = asymmetric visibility; it just inherits and continues what readonly = already started, so it's consistent. >>>=20 >>> The PR should be updated in the next week or two with the latest = changes. Baring any major need for change, we expect to call a vote for = it shortly after New Years. >>>=20 >>=20 >> Okay, then I'd like to officially "request" that the abbreviated form=20= >> [1] is dropped: >>=20 >> I believe 'protected(set) string $foo' is easily confused with=20 >> 'protected string $foo' at a simple glance. >>=20 >> Also any implicit rules are something developers will need to learn = by=20 >> heart, whereas an explicit 'public protected(set) string $foo' could=20= >> reasonably be understood by someone without any PHP experience and = some=20 >> basic experience of OO concepts. >>=20 >> Having two separate explicit keywords also makes it much clearer that=20= >> asymmetric visibility is involved, because it's also asymmetric in = the code. >>=20 >> I believe the only benefit of the abbreviated form is saving 6=20 >> keystrokes (+ one hit to the spacebar) and I don't believe it's worth=20= >> the lack of clarity for an important property of the defined = property. >>=20 >> Best regards >> Tim D=C3=BCsterhus >>=20 >> [1] https://wiki.php.net/rfc/asymmetric-visibility#abbreviated_form >=20 >=20 > Does anyone else have feelings on this point? IMO, the shorthand = makes a lot of sense when used with readonly to avoid lines getting just = annoyingly long, but without it I can see the argument for not allowing = it; it's about a wash in terms of length with readonly today. I'm = comfortable going with the consensus on this one for now. >=20 > --Larry Garfield Hi, As of today, the following declarations are rejected as syntax errors: ``php class C { $a; int $b; } ``` while the following declarations are accepted with implicit `public` = visibility: ``php class C { static $c; readonly int $d; } ``` It would be reasonable to propose to allow to consistently omit the = `public` keyword. But allowing to omit it in some cases (including the = most controversial one: `protected(set)`) and not in other cases...? = Because of this inconsistency, people are incited to always write = explicitly `public` anyway. =E2=80=94Claude --Apple-Mail=_AD616805-7072-4EB6-AE2E-97B13C00FD5C--