Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118389 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 93250 invoked from network); 8 Aug 2022 11:20:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Aug 2022 11:20:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1DC3B1804A9 for ; Mon, 8 Aug 2022 06:21:32 -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.2 required=5.0 tests=BAYES_20,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-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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, 8 Aug 2022 06:21:31 -0700 (PDT) Received: by mail-wr1-f43.google.com with SMTP id h13so10887111wrf.6 for ; Mon, 08 Aug 2022 06:21:31 -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=cayFyPLaDftjK01gup3hK1/Bpt4r1UZK5gkQJiobzcw=; b=AdosInUMP/liBaHb9UpFNybZpymIDWUv2ZSCYSXymGcxLXZEDuMVioR7EW6SIbYHJA hS7UY4RRcVJdfBRgyc4nuO0fAkf8RobrzAyXfMqJKGfwDWuySNLoDLZnhifve7ngxRiq I8NlRVgsUMOQqkHShS4Q0wdXeDL5hAmcSYAt0ANNNhN+6sz2ObqyyP0qpnx9dYz8JcYU ZcxlEa2fPEAEzGQnssA0xhmB9nA8hd+ylnPhdlz0Ebn0/3l0gE4G0ndStn4pZOIAIj54 K9tHHIqei3VIrKNq2eHxVAxFXSnySoBAA5gJkxp/MkGcWdr3cyHHXgG1s49LWUipLwmw zGEw== 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=cayFyPLaDftjK01gup3hK1/Bpt4r1UZK5gkQJiobzcw=; b=2lCBbHzbwJD5TPK9po2Bir2Weu625l5aZl9eVFrSLucSMOFqij3tPCfcr9YT8VfamY ZnFbuqbyECfQzHsV7xsqp2e6OyfRpIR8eKLQKAGhvPFrYmkSlCrCXzvlBmvgjPcs3F6Q TcpwhGtX/idxOUWG9ljfNIccBCw0sG2Ufcxc6D5ji1ckKJw30eMaubPqQuhIjh0XMz6a Lf2u0DYRmOoIKl+pNjAquXH5lLEIic/61HP2t77dwG5vCxIVz9TQh+RNhnvpAnO0L1uK c82PL0ztVM7TIy81Yg/0fU5q8RtMvbAvI4fLuPwCRC0Eh6bfhf/cRnyrnYF7cuYObVuE 0D5g== X-Gm-Message-State: ACgBeo2x/erX1hJehHseUoZgcznNGKDYa6Ki86B5QLUO1jhIEx/GQqm6 /PFZoZn07tViA6fs7X33C/9TLxNFLK8= X-Google-Smtp-Source: AA6agR4J6e9Tr1p04mMIZn1NrUMTmAidCIl2BZxhTUuWZnHC7hMmmWBBPCNDs1PRMoRuuC6pZ/7Nag== X-Received: by 2002:a5d:4c4a:0:b0:220:6b4d:f809 with SMTP id n10-20020a5d4c4a000000b002206b4df809mr11654225wrt.84.1659964890569; Mon, 08 Aug 2022 06:21:30 -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 w8-20020a5d6088000000b002185631adf0sm11269236wrt.23.2022.08.08.06.21.29 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Aug 2022 06:21:29 -0700 (PDT) Message-ID: Date: Mon, 8 Aug 2022 14:21:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.12.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 08/08/2022 10:09, Stephen Reay wrote: > The RFC states that it’s to keep consistency with `readonly`, because __set on a readonly property that’s initialised throws an error - but isn’t that because of the nature of it being readonly, rather than because of the visibility rules? The error given is "Cannot modify readonly property” thrown from within the __set() method, not "Cannot access protected property” thrown from the outside calling context, when the __set() method is not implemented. If a property is "public readonly", the __set method is never called if you try to reassign it: https://3v4l.org/8PioE The proposal is that the same applies if it is "public private(set)": the assignment immediately fails, rather than falling back to the __set method. The logic, I think, is that a completely private property is "invisible", so __set acts like it doesn't exist at all and runs *instead of* the assignment; but a "public readonly" or "public private(set)" property is "visible", so the assignment is attempted and fails. However, I am concerned that the rules around where __set and __get are called are becoming increasingly complex with a lot of different concepts interacting - "declared", "defined", "typed", "initialized", "visible", "modifiable", etc. As I mentioned in a previous discussion, I think we need to work towards simplifying this - e.g. merge "typed" and "untyped" properties by making "public $foo" equivalent to "public mixed $foo", which would remove the distinction between "defined" and "initialized". Regards, -- Rowan Tommins [IMSoP]