Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120223 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 91311 invoked from network); 9 May 2023 23:00:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 May 2023 23:00:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6FDA918053F for ; Tue, 9 May 2023 16:00:07 -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, RCVD_IN_MSPIKE_H2,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 out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 9 May 2023 16:00:06 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id BDCC85C01A5 for ; Tue, 9 May 2023 19:00:05 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute4.internal (MEProxy); Tue, 09 May 2023 19:00:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=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=fm3; t=1683673205; x= 1683759605; bh=9ZuRDywNv4H/f/2YHR4rRpjFQlI/DItCK+8V4jMSo44=; b=q 1zYmpzplJbnGGVqcMTJJcu7pd2dv/6Z5VbEXCBZuIsVo6nmxgCL/Xw4iWQAQdSYQ KMuOG7sL3OFBnqxO4Ncu1tWsjLDJrjHt4GwiPuo2sAcwhPiQcARsSToyUaAal4dt jytSE9JYJNnK9gPTIIJVkm8TpM+vZwZIA+JBYhoBhXWBpYhg57M82Twt5r9mkRMs MOV7T9tLLzCF8YSvfqi1SuTmatapvqA9+b/DAWyKPzzAOE8xDU3SCTm4zKGqdYiF IDICXWbXJRTJlN/jTElyMIFOunn7xI2tLbX5PvJFIot3HRo+h2un/cIe3Mc0fsjl mlm0srBI3lyxo0TPVmsIw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=fm3; t=1683673205; x=1683759605; bh=9ZuRDywNv4H/f /2YHR4rRpjFQlI/DItCK+8V4jMSo44=; b=TzvVlFM9QbKZd2kCJ4Vqw7mjIkLq9 c5ZtW1GeFoST0xacAzYC8pLqXSlS/rs+BJZgY/zafq2ALfpk8bUDsEeNSOUvsonm R1RQgB5Jpkt0Kbm1uZKg6r1EP/i6yL0ly+yzaA/1Ooe4PeCoSLK8o/8M+ChhXw3/ WebI4Wg4vOjCIF9HpPx154cx0151OGEHe0I1DjPPRGoaD6Bf7ZWZaSDhDpZRdW32 fT5Br6DcX7FrAcArNAVUxBawu3bHtt4d3R7QpL28S4gLWpvvZJefZKrYgeZk2H2a 90448VNnZON81hYSvPkIANdbAiNBkEiafqdnE8Atl7DdCBT3Ly8qe09YQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeegvddgudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeeglefgkeduiedvvdetffeujefftdfhjeeiveehgfff keduveektddvledvvdfffeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 527BE1700167; Tue, 9 May 2023 19:00:05 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-415-gf2b17fe6c3-fm-20230503.001-gf2b17fe6 Mime-Version: 1.0 Message-ID: <4cf59bcf-396c-4d20-a7b1-13a63b8c5d08@app.fastmail.com> In-Reply-To: <57aed5a4-f5e5-4a47-bf7a-69249f1d0ef1@app.fastmail.com> References: <641b1ca0-d33f-4f38-ae64-81b4abce24da@app.fastmail.com> <57aed5a4-f5e5-4a47-bf7a-69249f1d0ef1@app.fastmail.com> Date: Tue, 09 May 2023 22:59:43 +0000 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC] Property hooks, nee accessors From: larry@garfieldtech.com ("Larry Garfield") On Tue, May 9, 2023, at 5:46 PM, Larry Garfield wrote: >> I have a bigger concern: the take on references contradicts with the intro >> about BC breaks: turning a materialized property into virtual one would >> break BC as far as refs are concerned. One idea to fix that: add a ref >> hook, that must return a reference. If not implemented => Error when trying >> to get-by-ref. This could also help solve the $foo->array[] case (including >> the asym-visiblity issue). > > That might be possible. The issue there is that the returned ref would > still be bypassing the get/set hooks, so you're just adding a way to > dance around the existing hook implementations, which is exactly what > we're trying to avoid. Also, what would that hook even mean if used on > a virtual property? > > Moreover, in practice, getting a reference to a property is extremely > rare, with the exception of array writes. I cannot recall the last > time I even saw some code get a reference to a property. That's why we > felt comfortable just leaving it at is. In an earlier version of the > RFC we had a way for properties to just disable references without > adding any hooks, but removed it on the grounds that it was not worth > the effort. Addendum here: The RFC wasn't clear, in part because I wasn't clear, but the prohibition on [] on properties applies only on set. On get, whatever array value is returned from the hook is just a boring array, which can then be dereferenced to look up a key. I've updated the RFC accordingly to make it clearer what is and isn't allowed with arrays. --Larry Garfield