Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119133 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 96113 invoked from network); 13 Dec 2022 17:03:09 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Dec 2022 17:03:09 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D3C09180504 for ; Tue, 13 Dec 2022 09: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.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, 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-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (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 09:03:08 -0800 (PST) Received: by mail-ed1-f52.google.com with SMTP id e13so18651604edj.7 for ; Tue, 13 Dec 2022 09:03:08 -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=Te+/LTdwHdopQ2bL2xX4SI4w9Lx3OLeGCpaGeJUS/U8=; b=ALmhyiYxnrcIv9u1QCblE1aniIU2R3stvL3fKEYL5pOaHjLYn0CcB71wIGENU8fHsm 7E2KC9Rfkyqt38solJX4/ECGVssh1VYdxgg0pohCss1D4wolhahgqdRDCbkSls/aYHEf iks8ZjspzGt3Ld8WCszeaT3s1lTAnjaNYsy72JoOM22kgojNxcIWPfpInFRByQc8GavA h1iA5/QbVeREV9OaAaMPAe/pTmBe+kvlmpVljUL7PEANBVtHCt66ZYH1LBkjQy0uGNIk NO/t6QvqcHYgZlmnplOGOUyl9oBWyI42MrsbqLvGUjTrBXAEi9/VbKoFoo/uuz7dl4PM hDRA== 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=Te+/LTdwHdopQ2bL2xX4SI4w9Lx3OLeGCpaGeJUS/U8=; b=M9oZKUE2mbjuS52BbWnZO35i1aqh6jC1cMGBr97cUKv0OG4NFW1U18sThBJE7E6xL/ 2x3snamMNzK42dI1M1zeIKHzD5754VaVbJ2P/LGJotFw0ZZKY2pGqlJceXQ++56QFYRl gN6HTXMubzRF5ExXqTHOJxmzFKTzyX5jrLMCGg8aQFFGBojSQmUFbGGrSQPF+UOQ4L+6 v7ic5atg1jvp+lt7hfwy89xyD6xRaNvCYtg7dDbUzfs+FBHt5HMcxSDEMkaQmmcE9DRB DSh6satccP/44by3vf/jPvGxqZL+iyJowElJf8jMzg3pRdIt7eksrZb93Yfx4wkDgTOS FiDQ== X-Gm-Message-State: ANoB5pmT3ONY1bm2Nbs33bXoJFYtqExnA9h3ydMYCK9T0fP0FRohUmOH qeaU8c2HHQhckrxZH9SHUkg+J2gEhWw= X-Google-Smtp-Source: AA0mqf6SeSVifV6TpXhPcwGAROV+n9gY+KF5T42ietdP9AChJ43Lq9AAc/Vw6IBe3G49OQwFdFpCUw== X-Received: by 2002:aa7:cad7:0:b0:461:b693:3d61 with SMTP id l23-20020aa7cad7000000b00461b6933d61mr18490570edt.6.1670950986922; Tue, 13 Dec 2022 09:03:06 -0800 (PST) Received: from smtpclient.apple ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id ee48-20020a056402293000b004615f7495e0sm5179579edb.8.2022.12.13.09.03.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Dec 2022 09:03:06 -0800 (PST) Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_D95E7B86-436F-40AE-94E5-B15A41040F37" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Date: Tue, 13 Dec 2022 18:03:05 +0100 In-Reply-To: <84647C1B-0F61-41E5-981D-B860BE1E53CB@gmail.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> <84647C1B-0F61-41E5-981D-B860BE1E53CB@gmail.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=_D95E7B86-436F-40AE-94E5-B15A41040F37 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 13 d=C3=A9c. 2022 =C3=A0 16:34, Claude Pache = a =C3=A9crit : >=20 >=20 > Hi, >=20 > As of today, the following declarations are rejected as syntax errors: >=20 > ```php > class C { > $a; > int $b; > } > ``` >=20 > while the following declarations are accepted with implicit `public` = visibility: >=20 > ```php > class C { > static $c; > readonly int $d; > } > ``` >=20 > 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. >=20 > =E2=80=94Claude However, I=E2=80=99m just realising that omitting `public` in = declarations like `public $a` and `public int $b` is probably not a good = idea, because it is incompatible with constructor property promotion, as = `function __construct(public int $b) { }`, and `function __construct(int = $b) { }` have different meanings. =E2=80=94Claude --Apple-Mail=_D95E7B86-436F-40AE-94E5-B15A41040F37--