Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121708 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 22612 invoked from network); 17 Nov 2023 15:59:03 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Nov 2023 15:59:03 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3C67B180031 for ; Fri, 17 Nov 2023 07:59:03 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-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,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 17 Nov 2023 07:59:02 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 1923C5C0194; Fri, 17 Nov 2023 10:59:01 -0500 (EST) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Fri, 17 Nov 2023 10:59:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:cc:content-type: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= 1700236741; x=1700323141; bh=+Tg1c83Lb4dQDYtP+3v2zCu3vNcUQClvvNS g4XEx5Hk=; b=nC1/jLACTrkFw91H6j5rHFi/Dh6dyiv6hAxJtycEvQ6kd77GcL2 Zlc2qm8msigHsVgT4oSAKIkBbeaATZgxVWQm6MywEuzGc6L/AWqujYdugpTV3kor jH3VszyDcmNaikSVZ+F57eL0/YX2YWpHK3BUZ87nC0SsqCbjCWBm6itR0QEvjwI5 SevMelhWP7tUNa7KaLbAK0nI0tNxTQYJpj1nGyMYFtByO2mATNMd4VBdRFjqoiID M/uio6B2FbCSVyeegrPf8BcIci1i3dXY0u1oV1mSZwO2L3nHc0OS4JNun8Vyphdi 2TVoTroFFPEefTjlU3KDgyA+w5yBbahHJkQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type: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=1700236741; x=1700323141; bh=+Tg1c83Lb4dQD YtP+3v2zCu3vNcUQClvvNSg4XEx5Hk=; b=ejls7riAKOWID1mk7PA8Fo0jtxf5u I8n0razsEBiJfYYyJ7A0sIP8+KOlHZAYj5a7n6oxUF3M2mzox/y+g9xBehJM1G9G 2RiXgTrFrMVaarJwEWIHjfQtYGjYspty3alimDir23l3LgPKZcn31YHjKXr+our/ 7409TeMN4K/2QXo+GMZHVhhfywFnZeJp5kpqTFLRkvoV7PTzPxYQjFdVLrp45Bo1 E3EBnyMz6HjIHqr4I4PDFRLawDR1ZqDzD3oMJnuyhC1firQ8JD4gdRPRXEdFd0zl beMUnuFAB/hRvoGbDSZneeGGgDE14O1iYpkSp85jGhVE8vt5t+L/ir/4w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudegtddgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepueeludelieekhfekkefgieduffejffffheevkedu ueegtedtfeetheekgeeutdfgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 6DF841700089; Fri, 17 Nov 2023 10:59:00 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1108-g3a29173c6d-fm-20231031.005-g3a29173c MIME-Version: 1.0 Message-ID: <84fcf08c-4f03-4583-9677-c1796bac3325@app.fastmail.com> In-Reply-To: References: <2b4591c1-f999-49b5-8061-67db816aa0da@gmail.com> Date: Fri, 17 Nov 2023 15:58:40 +0000 To: "Rowan Collins" Cc: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC][Discussion] Harmonise "untyped" and "typed" properties From: larry@garfieldtech.com ("Larry Garfield") On Fri, Nov 17, 2023, at 10:47 AM, Rowan Tommins wrote: > On 16 November 2023 21:38:48 GMT, Jakub Zelenka wrote: >>This sounds like a huge BC break. Probably bigger and a bit harder to fix >>than disallowing dynamic props. > > More common, maybe; but trivial to fix: add "=null" at the end of all > untyped property declarations that don't already have an initializer. > It would be trivial to automate with something like Rector. > > >>Maybe it would be better to do this as some sort of opt in behaviour > > We already have the opt-in behaviour: add "mixed" to a property > declaration, and it no longer gets initialized to null. The aim of the > RFC is to eliminate that distinction, not to encourage typed properties. > > > > I do however agree that the initial value part is quite disruptive, and > am open to suggestions on how to minimise that. A couple that have > occurred to me: > > - Change the unset() behaviour, which we're already planning to make > produce errors in 9.0; but keep the implicit initializer. In other > words, make "public $foo;" equivalent to "public mixed $foo=null;" The > obvious downside is that it's just as weird a special-case for users to > learn as what we have now. This seems like the easiest way forward, with the fewest breaks. In particular, I would therefore expect reflection to treat `public $foo` as though it had been `public mixed $foo = null`, and thus normalize how the object looks. That's one less edge case for me to deal with, so I support that. As noted, though, there's still readonly to consider. Of note, both ?? and ??= currently treat uninitialized the same as null; this is a very good feature that is extraordinarily useful, and has the nice side effect of reducing the impact of this change. --Larry Garfield