Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118358 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 48376 invoked from network); 5 Aug 2022 17:52:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Aug 2022 17:52:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 67AE61804F8 for ; Fri, 5 Aug 2022 12:52:57 -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=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS29838 64.147.123.0/24 X-Spam-Virus: No X-Envelope-From: Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 5 Aug 2022 12:52:56 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 650B63200124 for ; Fri, 5 Aug 2022 15:52:55 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Fri, 05 Aug 2022 15:52:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to; s=fm3; t=1659729174; x=1659815574; bh=Q/jXBT6Sv2Q5dPr9kVB1zH+U6 l2ARl+cLis49q7Gv9Q=; b=FHJM645rP8M0voBuHuJVQMJkx1PKSx0lzTvnHB4tk I/1OuAfeuu3sUiqJc44wyBDyx7m+TOuJ3Cb7kaJ2Wl8/+X5jGaYv854cgusLz2YT KZfL2ZvzOMq1x6Ei14BSjUd33Mdtye13xyV5iczHKf6z6r3ASqUmjY84ypNpVDi2 M3pI2Tn+tl3FvRJYsdTScoa7/lm8/sDTFds3DWkKJDjDVa+2U2398/7d5MhWuSLk SUa/7kPTtx/uSTnxaCvzoFYuhiWLvwnqN0V6zYOHMn8fIInzO7dL3yy7yEFacroU t0DFYZO75frgXh23yb4jEw6gujXTDMW5tCS91FX1xVeog== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1659729174; x=1659815574; bh=Q /jXBT6Sv2Q5dPr9kVB1zH+U6l2ARl+cLis49q7Gv9Q=; b=sGx8lFcfY51lzcTz4 qUQTEGuBvfAapdXuI11Qz1h+IemNLRvS4liQZ6Xh6EDq0QAPAPLFICaRi7nezBkS op1tGLd9nXvIkObkdZH6QuXtQ3HlYKZj7i/zQf8EbqKZ1s2jg/mKhoNa4wYEloCw CBjqhkJhB+0NYrgM1AtY+Hmb7Pimf9YaI2zveom/XWz6n8l8LldzLjSQN01yL4MJ MaE6EKk7sOn3nmiCJhIePr4caRceBP6Wt3nAvmgqcV/DykLrQ4LEekEmzBPYtk2V uK08nh3KH2jCY5U+ZV0cJaTfSTeL9YJRvOWWPwGt5fG62HlIaFi0t1zqdeTeA9qw sbSXQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdefuddgudeghecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdfn rghrrhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrd gtohhmqeenucggtffrrghtthgvrhhnpeeggeehgfetjeehgefggefhleeugefgtdejieev vdethfevgeeuudefleehvdetieenucffohhmrghinhepphhhphdrnhgvthenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghr fhhivghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 8E4911700083; Fri, 5 Aug 2022 15:52:54 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-758-ge0d20a54e1-fm-20220729.001-ge0d20a54 Mime-Version: 1.0 Message-ID: In-Reply-To: References: Date: Fri, 05 Aug 2022 14:51:41 -0500 To: "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Asymmetric visibility From: larry@garfieldtech.com ("Larry Garfield") On Fri, Aug 5, 2022, at 2:27 PM, Micha=C5=82 Marcin Brzuchalski wrote: > Hi Larry, > > pt., 5 sie 2022, 19:09 u=C5=BCytkownik Larry Garfield > napisa=C5=82: > >> Ilija Tovilo and I are happy to present the first new RFC for PHP 8.3: >> Asymmetric Visibility. >> >> https://wiki.php.net/rfc/asymmetric-visibility >> >> Details are in the RFC, but it's largely a copy of Swift's support fo= r the >> same. >> > > Thanks for taking efforts on new RFC. > > Why not C# style property accessors? It feels more natural for me while > Swift solution IMHO looks weird/odd composed with PHP class definition > syntax. The arguments in favor from the RFC look forcibly (couldn't fi= nd > better word). > > Cheers, > Micha=C5=82 Marcin Brzuchalski There's a couple of reasons. Ilija and I have spent quite a bit of time= brainstorming through accessors, and there's still a lot to finalize th= ere, and lots of bikeshed potential. It's a non-simple problem space. = However, asymmetric visibility is a good stand-alone concept that can wo= rk without accessors, and has ample benefits of its own without accessor= s, and has far less bikeshed potential. (There's minor debates that mig= ht be had over syntax, but the behavior is fairly "it is or it isn't".) So the primary reason is that this syntax allows us to have asymmetric v= isibility without having to think about accessors. We can then, at some= point in the future, have a different discussion about accessors and no= t have to worry about asymmetric visibility in the process. The C# synt= ax by nature only works if they come together in the same RFC, or at lea= st one RFC is built such that it locks in some decisions for the other R= FC. As an example, one thing we've been discussing is if accessors should be= inline with the property (a la Swift and C#) or annotated methods (as i= n Javascript and Python). There's good arguments for both approaches, a= s well as good arguments against. But those would have *extremely* diff= erent implications for how we represent asymmetric visibility. So if we= took the C# style for asymmetric visibility, that would realistically l= ock us into C# style accessors even before we've had the discussion abou= t if we want that or not. That's not good. (Please don't anyone try to debate which accessor approach to take here;= the whole point is we want to introduce asymmetric visibility without h= aving that debate yet. We'll be able to have it in the future, I'm sure= . There's other knock-on effects as well that I'm skipping for now as n= ot relevant.) Keeping them separate also makes extending visibility rules in different= directions (as noted in the Future Scope section) at some point in the = future can also be done without bumping into accessors. Whether or not = those directions are useful is a topic for another time, but it again al= lows us to discuss those (like a "once" operation or a "package" scope, = etc.) without worrying about the impact on accessors. Secondarily, the C# style means you have to look both before and after t= he property itself to know what its visibility rules are. That's increa= sed cognitive load. This way, all of the various "flags" on a property = remain in the same place, and presumably 99.999% of developers will put = `public private(set)` right next to each other like that. That makes th= e visibility readable all from one spot, and if all you're using is that= and not accessors in the future, the impact on your existing reading sk= ills is minimized. This one is admittedly a bit more subjective, but re= adability and cognitive load are certainly considerations to, er, consid= er. --Larry Garfield