Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121774 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 27596 invoked from network); 23 Nov 2023 09:28:40 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Nov 2023 09:28:40 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B03CC18003F for ; Thu, 23 Nov 2023 01:28:43 -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=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) (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 ; Thu, 23 Nov 2023 01:28:40 -0800 (PST) Received: by mail-qv1-f51.google.com with SMTP id 6a1803df08f44-67a04a69f76so951716d6.1 for ; Thu, 23 Nov 2023 01:28:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700731715; x=1701336515; darn=lists.php.net; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:user-agent:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=irgj4iQXbdRU2kXXfBNq1zyY6CyUMmLzaD9m9QiqMOM=; b=LETZfz1bZe4nyOgX88ZZgkGmDxZ/UyWMySwdJCyEo0gPapr+58F/FnUegiojO9LkQS Od/7PSJnrOrc8E8Mf5gAsm7lG9mMkIFyUSv96YY0EuqkJlw7lXweeNVntFCcXdGVPw1w EuLutVI0t7U9sz1L/K+UTgiffMKGwPqlkaTrp/FNDmvOu82IihKVuvfijXuBvPBK4m9w goTcoN+bi9cC/Rn/8nEQ6M+kpwq9+PtGytkzUHr6D+d+lhf/5Wo5cng5vKMqWxgmkkvA H1qaJ2AdGHGCZ+HHlVdyakECck3+7Vh62TbJ7gidDuoh/hTX3oi5nukDzOnuzHg1YFHr VI+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700731715; x=1701336515; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:user-agent:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=irgj4iQXbdRU2kXXfBNq1zyY6CyUMmLzaD9m9QiqMOM=; b=OJSZCdqrWPs9sbs2TPCqQeJDXeeUtjPcgq41O0C2cXg6krlF0XMDRC9fvxnqlpYsTY iJh/PooUwSuFg3VZ0KUICd39w2Wf4eDc7sJaSpXdZzZRLIHfufetPck67mwtRsk1cPMB WSDxEja6YC1Pv0XeTIRStPgUl0cvl9VOaRI5hbf/T79kooROctg1e1yyKT4diz0rchwH NIfl8a3Q2i9wIBgB2HGCyEwBUyaRAZz2lw9UtqZfh1I96lp9sPktpR6pD841W3ScdnwW fVRKL4SSEpHjR+VYSOQMTovw29ry7bhMPZPkwt09tAz0IKUwCxrTYQ/ve71UVSMdT7p7 +Izg== X-Gm-Message-State: AOJu0YypnUuLfjvs0ysyij56/hxumdD2CcGJEhmJErr/fFm6WEFCW7W2 lrWpRMSKpBhfuIcry+4YS70= X-Google-Smtp-Source: AGHT+IF0gltD7JFAVbBxxYYSpbb9EEp0EOGYb4Zhp2KCY1OHkpGc6FR+Hihf+lkWN8ESBGhaNLBT2w== X-Received: by 2002:a05:622a:1885:b0:40f:dcda:ea10 with SMTP id v5-20020a05622a188500b0040fdcdaea10mr5634534qtc.3.1700731715277; Thu, 23 Nov 2023 01:28:35 -0800 (PST) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id ks23-20020ac86217000000b00421bad3d029sm342955qtb.24.2023.11.23.01.28.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 01:28:34 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailauth.nyi.internal (Postfix) with ESMTP id 5CB2327C0054; Thu, 23 Nov 2023 04:28:34 -0500 (EST) Received: from imap48 ([10.202.2.98]) by compute4.internal (MEProxy); Thu, 23 Nov 2023 04:28:34 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehfedgtdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvvefutgesrg dtreerreerjeenucfhrhhomhepfdfpihhkihhtrgcurfhophhovhdfuceonhhikhhithgr rdhpphhvsehgmhgrihhlrdgtohhmqeenucggtffrrghtthgvrhhnpedtjeegfefhgedvgf eugfdutdettdekvdekudekheefiefgtddttdekueegudeiheenucffohhmrghinhepphhh phdrnhgvthdpghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepmhgrihhlodhmvghsmhhtphgruhhthhhpvghrshhonhgr lhhithihqddufedufeeludekheeiqddvheekvdegheeikedqnhhikhhithgrrdhpphhvpe epghhmrghilhdrtghomhesnhhpohhpohhvrdgtohhm X-ME-Proxy: Feedback-ID: id4a9467a:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 0A1DD31A0064; Thu, 23 Nov 2023 04:28:33 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1234-gac66594aae-fm-20231122.001-gac66594a MIME-Version: 1.0 Message-ID: In-Reply-To: References: Date: Thu, 23 Nov 2023 10:28:13 +0100 To: "Nicolas Grekas" , "Rowan Tommins" Cc: "Levi Morrison" Content-Type: multipart/alternative; boundary=c63e7c567ae648b8ae4a04a6c8d96c50 Subject: Re: [PHP-DEV] Re: [RFC][Discussion] Harmonise "untyped" and "typed" properties From: nikita.ppv@gmail.com ("Nikita Popov") --c63e7c567ae648b8ae4a04a6c8d96c50 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable On Thu, Nov 23, 2023, at 09:48, Nicolas Grekas wrote: > Hi Rowan, >=20 > Le jeu. 23 nov. 2023 =C3=A0 08:56, Rowan Tommins a > =C3=A9crit : >=20 > > On 23 November 2023 01:37:06 GMT, Claude Pache > > wrote: > > >What you describe in the last sentence is what was initially design= ed and > > implemented by the RFC: https://wiki.php.net/rfc/typed_properties_v2 > > (section Overloaded Properties). > > > > > >However, it was later changed to the current semantics (unset() nee= ded in > > order to trigger __get()) in https://github.com/php/php-src/pull/4974 > > > > > > Good find. So not only is it not specified this way in the RFC, it > > actually made it into a live release, then someone complained and we= rushed > > out a more complicated version "to avoid WTF". That's really unfortu= nate. > > > > I'm not at all convinced by the argument in the linked bug report - > > whether you get an error or an unexpected call to __get, the solutio= n is to > > assign a valid value to the property. And making the behaviour diffe= rent > > after unset() just hides the user's problem, which is that they didn= 't > > expect to *ever* have a call to __get for that property. > > > > But I guess I'm 4 years too late to make that case > > >=20 > Sorry this comes as a surprise to you but you're rewriting history her= e. > The current behavior, the one that was fixed in that commit, matches h= ow > PHP behaved before typed properties, so this commit brought consistenc= y. >=20 > About the behavior, it's been in use for many years to build lazy prox= ies. > I know two major use cases that leverage this powerful capability: Doc= trine > entities and Symfony lazy services. There are more as any code that > leverages ocramius/proxy-manager relies on this. >=20 > About the vocabulary, the source tells us that "uninitialized" propert= ies > that are unset() become "undefined". I know that's not super accurate = since > a typed property is always defined semantically, but that's nonetheles= s the > flag that is used in the source. Maybe this could help with the RFC. This. The lazy initialization use case is the only reason why we still a= llow declared properties to be unset at all. Our long term plan was to find an alternative way to support lazy initia= lization for properties, and then forbid calling unset() on declared pro= perties. However, we still don't have that alternative today. Regards, Nikita --c63e7c567ae648b8ae4a04a6c8d96c50--