Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118381 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 58723 invoked from network); 8 Aug 2022 06:08:12 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Aug 2022 06:08:12 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1A1BB1804F8 for ; Mon, 8 Aug 2022 01:09:23 -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.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_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-vk1-f178.google.com (mail-vk1-f178.google.com [209.85.221.178]) (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 01:09:22 -0700 (PDT) Received: by mail-vk1-f178.google.com with SMTP id r4so4026356vkf.0 for ; Mon, 08 Aug 2022 01:09:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=oX+S91Sjt3Gvls2NeFqzDbPXs4/poyYCNqft/aWIqxE=; b=MQWTDUQbM5nwjg6rCl1wkV8qXMwIz5HPZ40gwzYDzrPFCp2L4tRFlCxgY8hdNqrwfV bb/m7e82lETt7drpJLEkjAN5vPrWBZw4rm9QHcimpQswgewIfiarTmsUq6g1h+t9Of9Y g9o2JgUP/W4WgSJ0YDbPcbUYjjAnZwBGTeqq2WMNy1M4SAyxG2Le1DBTabmzZT4fEkRZ /RIYHDZnonbzY+uh+GuzK6XpFSPExsa+mVzKqvGOVn2CXbtntr/MrKagY4S+v62ACf6v Gv448yjB30ZoPMve1P9tilbkRCpYX6jr1LemVeK8V0bs2kEaYBKr3x7H6s3uY+lyGYAH mAOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=oX+S91Sjt3Gvls2NeFqzDbPXs4/poyYCNqft/aWIqxE=; b=2pz8F8P/mzhBk7T+AVtw8871GvrDZ7TXcAzRlrME5TJb+jkYn41FLqb+8YOoecgc3q KcIfL+BfJtcXLIxJXg6tJLvifFcxQiO8FFH1P6HYsk79s3Upsk20WhmAwSf+x0YGPgFC 1Snpy4Al25dIWfBkSZNnxPEqJ/IcCeZYnbEKUAUnh9rv/QRci1h8bSbr8LKHTR7Bzm1+ aV0hxTE5ID1BtcaDcBtmHHn1/SjugiW2QpgMF6s5i/yA5xSlP+ubAzgexOsoxC7IVvuf AcVUIHPQBZO5J+TCZXdcidCmoIYm4l22g/6Q+cr1E1xZDUAi7baq3H1RWfCyRk59pcgh mIkg== X-Gm-Message-State: ACgBeo0Ve53LoYmUgYMMWQuuQtajBbfDHYs08SBHxLB7eexOaxOy311E 7tEo820zUpdeQ77LhiFngmgsx6e0uOnfcmebxQY= X-Google-Smtp-Source: AA6agR4cL++evqjPK/ysG1hwCbUApcxTriQH/1JIkhYooWNDIZzaHmAyFNAzZ5Oa61SR7Ur7qECKttWAM2qrQ4FMAEo= X-Received: by 2002:a1f:a856:0:b0:376:c61f:2f1e with SMTP id r83-20020a1fa856000000b00376c61f2f1emr6927866vke.35.1659946161880; Mon, 08 Aug 2022 01:09:21 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 8 Aug 2022 10:09:10 +0200 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="0000000000005344d905e5b65599" Subject: Re: [PHP-DEV] [RFC] Asymmetric visibility From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?=) --0000000000005344d905e5b65599 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Larry, niedz., 7 sie 2022 o 21:02 Larry Garfield napisa=C5=82(a): > On Sun, Aug 7, 2022, at 5:54 AM, Lynn wrote: > > On Sun, Aug 7, 2022 at 12:34 PM Rowan Tommins > > wrote: > > > >> Can you expand on where you think the ambiguity / implicitness is? As = I > >> understand it, the RFC is proposing exactly three new combined access > >> levels: > >> > >> - "public private(set)" > >> - "public protected(set)" > >> - "protected private(set)" > >> > >> Although aesthetically it will take a bit of getting used to, it seems > to > >> me pretty clear that the first means "mostly public, but private if yo= u > >> want to set it", and so on. > >> > >> The only thing I can think of that could be described as "implicit" is > >> that accessing a property by reference is considered a "set" operation= , > >> which I'm not sure how any implementation could avoid. > > > > > > Personally for me it's the syntax. Reading "public private", "public > > protected", or "protected private" reads really weird `public > private(set) > > static self $property`. In the end it makes sense if you know what it > > means, otherwise it's probably confusing. I really like this RFC and I > feel > > like this might just be the way to go forward, but I have my doubts abo= ut > > how many more keywords can be realistically added before it becomes a > > problem. > > What syntax would avoid having the visibility keyword repeated? if you > want "public get, private set" behavior, I don't know how that could be > done without having the words "public" and "private" both appear somewher= e. > > Also note, since using private(set) is mutually exclusive with readonly, > that the resulting keyword list is about the same length as the existing > "public readonly string $foo" that has cropped up frequently with PHP 8.1= . > So... yes it's another keyword, but it's not more keywords that can exist > simultaneously. And moving the keyword to the right (a la C#) wouldn't > make it any shorter; if anything it would be even more keystrokes. > > Very close in size, same in complexity: > > public readonly string $foo > public private(set) string $foo > Since the radio request show already started wanted to push my 0.50=E2=82= =AC Instead of thinking how to improve visibility on the left side, let's move all the visibility modifiers to the right but enclosed with parentheses, this way a future stays open for improvements and introduction of accessors. // instead of class Foo { public private(set) static int|string $id; } // let's do this class Bar { static int|string $id { public; private set; }; } A future improvement may add an accessor body on the right side of "set". Cheers :D, Micha=C5=82 Marcin Brzuchalski --0000000000005344d905e5b65599--