Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121773 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 24151 invoked from network); 23 Nov 2023 08:48:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Nov 2023 08:48:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1AE48180040 for ; Thu, 23 Nov 2023 00:48:27 -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-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 00:48:26 -0800 (PST) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4083cd3917eso3514315e9.3 for ; Thu, 23 Nov 2023 00:48:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700729301; x=1701334101; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=VJR8UpJZwUBCCUxWs1kBmflfZ7zZojQDvnq77I8lH+I=; b=S2gyCblOMpS7rVSoQnvkZujJgQ7h/7MBjS6wwa5UdP17POUXX7eNa2dPCDaOWjBGtc L52tGWQqWnoYy3mZ1PqRg/Im/CiIAvjJQRdXOj2TJgSdnkaQWEP7ztnJ2SPU0u6Z2046 TdQ3iApST4YIaPxBFtRBMjCa4Z/8/cpXVHEn20A9MbfiO2HB4pxByJF8N4TaIRTen5r1 /42lMQlntx6jqhmXiNu/iadVCBB7wuKjXiZLMlaczFVHPsN6l617AFjF8jtwW13oU91O IL/xtylRSnwJ8pd+lxbJ3XBga5lthbnradG7+bV6TRabFiTLryraxu1DhNadruG8xVTG NnFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700729301; x=1701334101; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VJR8UpJZwUBCCUxWs1kBmflfZ7zZojQDvnq77I8lH+I=; b=C2p684mpXcLFlXOJAnXkvsQCySNHEIvX8PEG3BE2f6bBecbpj3KxcCvtG2n05FoVs9 4QFmnmaz6nvWFemvTwRKGY+cRIgSV+Fw2MisXPIa8fwzH0rv3b9RTg95aIriFAvZRDsN TwGzriBmbXr7WlO0vNSdLj7XCuUPi3S2p/ozy39TLdlx8AvJqWKzzLFvDxTAUysVHSM0 LJWVb3MW61C/SEDMJ1X55uUT5QXl90EOYb/lya1a/alozw89gfcFkGhjWrwyFgDykHYk /sHbRB55ZjNr3YnYH8lpY/4yhg+a2dLNxmz2fNLRNzAlMZik0zJuq5dKYgR+KuiLKM62 5UlA== X-Gm-Message-State: AOJu0YwK5TopvgZjQdqSOWMsRe6GO69Hf3WTN2tIQGpp7ACbgWO1za6S fGUpxtILasUB98KyvEBRjKozlblJIK979Rxxqm0= X-Google-Smtp-Source: AGHT+IE6n9riITM3PSlJwgsVLv3EvAxjotQFtARoMyQAV+aZaVrqsurOKJLw5TKe/br1a39KF96iJBGxIrn1f6Iu+Go= X-Received: by 2002:a05:6000:108c:b0:32d:ae31:458f with SMTP id y12-20020a056000108c00b0032dae31458fmr3339819wrw.30.1700729300661; Thu, 23 Nov 2023 00:48:20 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 23 Nov 2023 09:48:08 +0100 Message-ID: To: Rowan Tommins Cc: PHP Internals Content-Type: multipart/alternative; boundary="000000000000d33c52060acde59d" Subject: Re: [PHP-DEV] Re: [RFC][Discussion] Harmonise "untyped" and "typed" properties From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000d33c52060acde59d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Rowan, Le jeu. 23 nov. 2023 =C3=A0 08:56, Rowan Tommins = a =C3=A9crit : > On 23 November 2023 01:37:06 GMT, Claude Pache > wrote: > >What you describe in the last sentence is what was initially designed an= d > 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() needed i= n > 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 rush= ed > out a more complicated version "to avoid WTF". That's really unfortunate. > > 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 solution is = to > assign a valid value to the property. And making the behaviour different > 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 > Sorry this comes as a surprise to you but you're rewriting history here. The current behavior, the one that was fixed in that commit, matches how PHP behaved before typed properties, so this commit brought consistency. About the behavior, it's been in use for many years to build lazy proxies. I know two major use cases that leverage this powerful capability: Doctrine entities and Symfony lazy services. There are more as any code that leverages ocramius/proxy-manager relies on this. About the vocabulary, the source tells us that "uninitialized" properties that are unset() become "undefined". I know that's not super accurate since a typed property is always defined semantically, but that's nonetheless the flag that is used in the source. Maybe this could help with the RFC. Cheers, Nicolas --000000000000d33c52060acde59d--