Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118375 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 17191 invoked from network); 7 Aug 2022 19:47:25 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Aug 2022 19:47:25 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CBBFD180380 for ; Sun, 7 Aug 2022 14:48: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=-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: AS19151 66.111.4.0/24 X-Spam-Virus: No X-Envelope-From: Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (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 ; Sun, 7 Aug 2022 14:48:32 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 790885C00BD for ; Sun, 7 Aug 2022 17:48:32 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Sun, 07 Aug 2022 17:48:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc: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=fm1; t=1659908912; x= 1659995312; bh=Q9hrPfORYX13WahM9Jweg8VE0mboCxnX+Ea2Et9ERh4=; b=n +sIAhXPeO5wyUWA3UVJqwT5Uh3rDHnMpemei7xXxVp2k6ll4N0CJe+6/clTpLHj0 lLwSiD2HmoalK8EgN1mO+qUJyyCOcRKjR0JLkGxgDk0Q7MNuCE1JtB4oT6vhMw8a JD/r+6HPHlzoBwTe+eNSTr80JcmD8RSf+NLmziJWCBjR6duVvDsG70cB7BEkMAzo OJBEnj4kTBM+aqlSP6NHPzgWnnikCP/cQtocgQCPE3cgUs6k2/vlmat2MBJluuSn Asw/6iOegNGI2LRlqau4DuqddAvCeWzMpSekNA0l6ngoTfXsB/lxP8tuVTTAyFUa N7gbzRTOcTYAETmVbYafw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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= fm1; t=1659908912; x=1659995312; bh=Q9hrPfORYX13WahM9Jweg8VE0mbo CxnX+Ea2Et9ERh4=; b=3Zs4UIlkeybIdLm1KwA6OG8SuksWJ74hS9hjpHvbGrbo s4o/rCuCovcTGh2JRYMmWx4XgImTNuFyqDHp6er4hGZE2wu6Rj1YZNgzKi6k7n2j ZtoMDTYRJfyIPGtCvZvN36uLRAhhJCl0BNiJUS1n0ucp8IRrf8CuZa8Rjt5/DddE yFZqBplhhK8w3e8Ob8uKAeMalVYHKUi2kGauR6J89+jZFKEVx3PRr2z0nfd/Hc+M Z68vWJ9oUisNHMhYstA/akuA3SVF+67Z0hIRGbA2A8oSRN3UYukVKG49Y30PMO+E Cu6ck1Mbiy4ENa7Io8mc80vQOGDhqzlyWqsUq7S8zg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdefiedgudeikecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepgeelgfekudeivddvteffueejffdthfejieevhefg ffekudevkedtvdelvddvffefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 3711D170007E; Sun, 7 Aug 2022 17:48:32 -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: <23a5ca61-a4d9-4a39-9364-2fdd1688f918@www.fastmail.com> In-Reply-To: References: <578bd2ba-1594-fa0b-0f8b-3734af1f0383@gmail.com> Date: Sun, 07 Aug 2022 16:48:11 -0500 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC] Asymmetric visibility From: larry@garfieldtech.com ("Larry Garfield") On Sun, Aug 7, 2022, at 3:46 PM, Ollie Read wrote: > Just to throw in my ten cents: > > I'm not sure if this is because I was recently reading about the fact > that PHP doesn't have proper support for a comma operator, but I quite > like the idea of providing them as a comma-separated list. > > // Public for get and set > public int $number > > // Public get, private set > public, private int $number > > If a single visibility is provided, same old same old, but if two are > provided, they are in the order of get, followed by set. While not > being as verbose as providing (set) or other markings to differentiate > them, it feels more natural, and it doesn't overcomplicate it. > > --- > Best Regards, > *Ollie Read* I'm not wild about implicit ordering as a syntax, for two main reasons: 1) It requires implicit knowledge on the part of the reader what's going on. Any kind of explicit syntax makes it clear "public, except for this operation". ("this operation" for now being just set, but then the set is right there and self-documenting.) 2) It makes extending it to other operations like "once" or "init" in the future impossible. (See Future Scope.) If we went with public, private string $foo, which implicitly meant "public(get), private(set)", and then in the future we add a "once" operation to mimic the behavior of readonly... what would that look like? With (set), it's self-evident how to extend the syntax. With it being fully implicit, I cannot think of a way to do so. Something like public private:set (colon instead of parens) would work just as well, if the () are confusing somehow, but that doesn't feel like a common problem. And it would lose the parallelism with Swift. --Larry Garfield