Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118371 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 8764 invoked from network); 7 Aug 2022 18:37:44 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Aug 2022 18:37:44 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8AB8A180506 for ; Sun, 7 Aug 2022 13:38:49 -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=-0.6 required=5.0 tests=BAYES_00,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, NICE_REPLY_A,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-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 ; Sun, 7 Aug 2022 13:38:49 -0700 (PDT) Received: by mail-wm1-f47.google.com with SMTP id az6-20020a05600c600600b003a530cebbe3so1601756wmb.0 for ; Sun, 07 Aug 2022 13:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=fHfb26ZPw6A0uxeNsqBdcveZa4gFqqsqrQVKsKjXsBE=; b=CNROc5lHtgaYHKsTVEw5FRq5zoDTUxXa9zQvQhLuK4B+/28m7yBV7n0T+ry28pVLOt vw9AP2hf+a1Rn1xzz7sfdq0hFu5gaZ4oJlnocsWK7+hCXJvk51FPDrzcKKO/Az72P6Uz hJo9By5IIvKGPLHn93sGVnOxOrQF1X5vQjobDs8f5d1Pwu2Bw83E+3qCazGr/I/Xz5mS 9MTbyHgc9UUEkXfJ42La8r4npvZX89vD3h82wlCbzwDOPfjVhh+WlWtWW6Upx8HrzzUd toFsZDXMNRNsGA1L0igTsolYbHcd9vuuZy734hp7TTpjKzPUFfRoVMy+5YToOWFKtTh8 BslQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=fHfb26ZPw6A0uxeNsqBdcveZa4gFqqsqrQVKsKjXsBE=; b=ruMMJZco6v0XLUVw/2SrJ6q2mAgRJ9s0BMqxLKixFc1ZBlp6t6ibNKmdru3UuUasSf 9p/+Uq37pbmbhFy+D6G5Bi5D18FOk8eOFiuooFV+IR7Qs4aQDLZHORUDkjDudSXPqJ0L 4VQSuxDnv8JrsLP3Y2s8cW1PiRKnCk0vIaEkuBXD7nhdV2CUKBgPbIXy1hFNBZUqPAu9 vXivapHY3n+MHfQdrCZ1mspMJrFk4HR5FHP0rtFMMoX2RtB4MbubPC4yEJLln3QctpWn JxOjpLY7O0DirEeTtfkKVlF4e85LUKkFcAvsmcMorRQUFESI0lGDAptBCchPPpVCsW4H cJMw== X-Gm-Message-State: ACgBeo1MyKHOxyWOa3B0n/oclkt+HlMSvFuwfRSLqNT5m3fz9c30V+jr 7CYvF2eQaOkNta+Vx9S1XDzfAScsCR0= X-Google-Smtp-Source: AA6agR6Ojlhtma+dctp2Rylb2yYEz7HSL1VZUXeYL1Dq407IJsVhZGOK9Xt9Ve0U4p2GAKXUWgn3Dw== X-Received: by 2002:a05:600c:1da0:b0:3a5:19ed:6c1d with SMTP id p32-20020a05600c1da000b003a519ed6c1dmr8293926wms.5.1659904727608; Sun, 07 Aug 2022 13:38:47 -0700 (PDT) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id c4-20020a7bc004000000b003a31673515bsm16110412wmb.7.2022.08.07.13.38.46 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Aug 2022 13:38:46 -0700 (PDT) Message-ID: <578bd2ba-1594-fa0b-0f8b-3734af1f0383@gmail.com> Date: Sun, 7 Aug 2022 21:38:45 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Content-Language: en-GB To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Asymmetric visibility From: rowan.collins@gmail.com (Rowan Tommins) On 07/08/2022 11:54, Lynn wrote: > Reading "public private", "public protected", or "protected private" > reads really weird `public private(set) static self $property`. Interesting, it seems that you've unconsciously broken it up as "public private" followed by "(set)", rather than "public" followed by "private(set)". Perhaps it's because of the position of the parentheses, which do feel awkward to me at first glance. Would it read more naturally to you with different punctuation? public (private set) static self $property; Or: (public; private set) static self $property; Or: public private-set static self $property; On 05/08/2022 19:08, Matthew Weier O'Phinney wrote: > I'm wondering if this sort of behavior could be indicated via attributes > instead? Something like `#[PropertySetBehavior(PROPERTY_SET_PRIVATE)]`. > Attributes have the benefit of being separate from the property > declaration, arguably more readable (one per line), and composable. Attributes are no more intrinsically "separate" or "one per line" than keywords; the following would be perfectly valid with the RFC's proposed syntax: class Foo {    public private(set)        static int|string $id; } And the following would be valid with an attribute like you suggest: class Foo {    #[PropertySetBehavior(PROPERTY_SET_PRIVATE)] public static int|string $id; } Even a shorter attribute name would have the extra punctuation, and the restriction that it comes before the normal visibility keyword: class Foo {    #[PrivateSet] public static int|string $id; } Regards, -- Rowan Tommins [IMSoP]