Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109045 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 14168 invoked from network); 16 Mar 2020 01:01:02 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Mar 2020 01:01:02 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CE7FC1804E2 for ; Sun, 15 Mar 2020 16:23:17 -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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,LOTS_OF_MONEY,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS11403 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 15 Mar 2020 16:23:16 -0700 (PDT) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 97FB8324 for ; Sun, 15 Mar 2020 19:23:15 -0400 (EDT) Received: from imap26 ([10.202.2.76]) by compute7.internal (MEProxy); Sun, 15 Mar 2020 19:23:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=mytbJ4qvUN2zVmW3zlaZ1KE6F+nAYUiPDMiDPp1D/ 7E=; b=Yv5tNfTDTfj6CjsS/Rt8MX1I/i8CWis1VhCCQwVGiriajnO7sQebPbJLY 7rOWyCur1LMEy5Lh2y73cfAbCE+FQCpAqSM6QoWsIidIUiCJKFLIArmEnWQIjhxK pH78I0/zDb5F1jfPi0I09o+7rILNaCwr5OxXKfPmd60fAkw0wdDGXPr9qI4f0n+A KpzKtSWTU1w34ui0rXPTxfkpY4DJHMEh+aId6+Wf2lLlsXB50FuyaDuon/dDOixv s14BQ9MeaFLVukNWpjLT7+lMo4omv7M3ztbsPi+h5OUM0/vbFbJG3sCRTEk8k31m 54JHrcxr8YzRtey9GSJdETED/9mJg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudefuddgjeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep lhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id D74DA14200A2; Sun, 15 Mar 2020 19:23:14 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-991-g5a577d3-fmstable-20200305v3 Mime-Version: 1.0 Message-ID: <421993bf-821c-4ebf-802a-be9814b30b90@www.fastmail.com> In-Reply-To: References: <8545d15e-ddd5-42be-8405-09697a077234@www.fastmail.com> <4d9688fe-cc57-44af-903e-05f4cbb1bbcc@www.fastmail.com> <6bcbf0a5-92d8-4cfa-a00f-e0e967fc037e@www.fastmail.com> <700327df-45d5-47ca-8828-d7ad9c9bee2e@www.fastmail.com> <6f2e7718-5d78-4c57-8da9-f8dd44cc9e7b@www.fastmail.com> Date: Sun, 15 Mar 2020 18:22:53 -0500 To: "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Immutable/final/readonly properties From: larry@garfieldtech.com ("Larry Garfield") On Sun, Mar 15, 2020, at 4:44 PM, M=C3=A1t=C3=A9 Kocsis wrote: > > > > Avoiding that confusion will save the industry millions of dollars. > > >=20 > On the one hand, you are right, because currently it's not very useful= to > effectively provide two > ways of declaring a constant. On the other hand however, if we also > consider a longer term > aim of adding support for object default values (just like what Marco > mentioned): > public read-only DateTimeImmutable $startupTime =3D new DateTimeImmuta= ble(); > then allowing default values for "write-once" properties seems much mo= re > sensible. At this point, > the "million dollar mistake" label doesn't hold anymore since class > constants and "write-once" > properties with default values will actually be two different things. = But > we've just ended up at > Marco's suggestion: I'll be honest, I really have no idea how default object values is at al= l related here. I mean, those would be nice to have as well for various= reasons, but I don't see how it's related to read-only properties. > > 1. Prevent the parser from accepting default values on write-once > > properties (parser error) > > 2. Re-introduce them once we know what we want to do with default v= alues > > (and it makes sense) >=20 > Yes, this scenario definitely makes sense. I'm just not yet sold that = it > will have any negative effects > if we don't restrict the usage of default values now. I understand tha= t > it's usually advantageous to be > conservative with adding new features - especially when groping in the= dark > - since we are the ones > who have to support and fix them later. That's why I was hesitant to a= dd > property covariance to the > proposal. The negative effect is if we later decide that it's too much of a proble= m to have default values, because they're just too confusing (people deb= ating if they should be a constant, people expecting them to be overwrit= eable, etc.), we can't simply remove them. That would be a large breaki= ng change and not allowed, so we're stuck with 'em. Whereas if we don't add it now, we can see if people are really clammori= ng for it and in what situations. We let the PHP-using masses do the re= search for us to determine how read-only-default would actually be usefu= l, or if it would be useful at all. Then we can add it later in a way t= hat would actually be useful, or decide not to do it at all. --Larry Garfield