Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122610 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id E23D91AD8F6 for ; Mon, 11 Mar 2024 14:28:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1710167314; bh=k3kNujDPRtHNf62X5uXRhfqrPo2D33K9L0NjPiFV4+U=; h=In-Reply-To:References:Date:From:To:Subject:From; b=QdJTDi148ODrMQpt7ga7A9qeKRS9+mrweJQKMrpSyv8enRgH99iabNhlj/Jzw3F3U LoDHHozvsx6eDt/SWRIyjKc3k41YHrhyoWIhIlB/eKUCFZZsuAr+L20xv4gaTg7ekw cLSCUVRD4oDVk47uTILLWehMyb8qg01TBKLvMYP6H1ndiJ8TrYsRXB6SVWAfrsjLch h/8wqDPwljx97R0qiPdEH5ZTHkXNlCtnKpKNzIhpU5Vd+12YNmLL2kWGB02dp9HSlP 1YCXTalu5tcJfuyMSHYpRhx8ZvenQ+DZdLhPtKSEd/oJJiRMPxDpfGfBUo8rmFvIoi U4wJC0PFbPfFg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A2EB9180070 for ; Mon, 11 Mar 2024 14:28:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (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 ; Mon, 11 Mar 2024 14:28:32 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 24C845C003D for ; Mon, 11 Mar 2024 10:28:15 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Mon, 11 Mar 2024 10:28:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm1; t=1710167295; x=1710253695; bh=/p4eyohqv+/TdqtIpdZkO x5zB9R+gsw6U9oH4pgj2Hs=; b=t9LX2u0DZyiTt6+70KouFE3t6kfHkD3R9pg3V cIqdp2IlgeMdXmaw2TYcB6X7kv4W5Yv0qzvW0QlfCrjkhp5CvwkKbde/972RYzg5 twlBQ2Bc1yHjVhRXckLIXy4gMZbqBM5JTs0I8LjJ975QaPwffiaSzLYzrJnTp03J iCu/wVetpqu7tlvcUUwhiYikSx8wHlyFvXyQ2tlz7aU7PLKCWgEgfEnEP1JLZ0MH InXjtn4RuVwtg3UUfrHVor0dj2HV9zTFui5F4pz7g6SlADsDSPrcxBgXKn2Q2k3l p+0XLtKcwF5GSen7PP9BOP4ANiKiZJGqeoX361G3oAxw5XxIw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1710167295; x= 1710253695; bh=/p4eyohqv+/TdqtIpdZkOx5zB9R+gsw6U9oH4pgj2Hs=; b=V tRie++QQ/GcD11IgeFa2jo/xbQQoUS9Dedy0DSpSiOj78itXjfY5yqSVt9fRsX+L tV5iqWmMC/5vOeiN2Nx258vEQAwN3klNLCAeA7mCX8RFpIsaUlApTybXCr2yDrtU O8nQ6Bc57KtyahuFormyvVhUqKZyNuvZ+Dc1Ze5vrQt6biIDvExgLUffGAEz5ARs gDGA9Hbr/qrO+q0fk6b5UZ59vsZyu16MnQu6xmJQoKS4k1uhtdPa5sYfXqAx0ru9 jKlUqNVzTmW+AD4jk/YlUvGrwuVImWO/LXID/g1u3CaV6cR4f8q8OdkrqxiKGkQ8 yIjFLBLgdhNtnDQkg4AWA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrjedugdeigecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeeggeehgfetjeehgefggefhleeugefgtdejieevvdet hfevgeeuudefleehvdetieenucffohhmrghinhepphhhphdrnhgvthenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhi vghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id BCE7B1700093; Mon, 11 Mar 2024 10:28:14 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-251-g8332da0bf6-fm-20240305.001-g8332da0b Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: <84adc38a-210e-4f21-9145-0c99ae8c56f2@app.fastmail.com> In-Reply-To: References: Date: Mon, 11 Mar 2024 14:27:34 +0000 To: "php internals" Subject: Re: [PHP-DEV] [RFC[ Property accessor hooks, take 2 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Mon, Mar 11, 2024, at 8:35 AM, Micha=C5=82 Marcin Brzuchalski wrote: > Hi Larry, > > pt., 8 mar 2024 o 16:55 Larry Garfield napisa= =C5=82(a): >> Hi folks. Based on earlier discussions, we've made a number of chang= es to the RFC that should address some of the concerns people raised. W= e also had some very fruitful discussions off-list with several develope= rs from the Foundation, which led to what we feel are some solid improve= ments. >>=20 >> https://wiki.php.net/rfc/property-hooks >>=20 > > This RFC looks awesome, thanks Larry and Ilija I love the functionalit= y=20 > in its current shape. > >> Thank you everyone for the feedback so far, and if you still have som= e, please say so. (Even if it's just to say that you're happy with the = RFC now so we feel more comfortable bringing it to a vote.) > > The only thing I don't like and can still be worked on is the=20 > reflection mechanism changes. > The proposed methods isVirtual and getRawValue, setRawValue pair=20 > introduces a need to catch exceptions which could be eliminated by=20 > subtyping ReflectionProperty. > Having these methods on a separate subtype allows returning a valid=20 > value. > I realize this isn't trivial because for the last 2 days, I was=20 > thinking about giving it a name and TBH cannot figure out anything=20 > feasible. > If this is not possible to put in understandable words then at least=20 > mention it in FAQ and why not. > > Cheers, > Micha=C5=82 Marcin Brzuchalski Hm, interesting. I'll have to check with Ilija on feasibility. My ques= tion is, how would it eliminate it? Suppose we hypothetically have a "ReflectionPropertyWithHooks" reflectio= n object. It has those three extra methods on it. But that means $rObj= ect->getProperty() could return a ReflectionProperty or ReflectionProper= tyWithHooks, and you don't know which it is. You'd have to do an instan= ceof check to know which type of property it is, and thus what methods a= re available. That doesn't seem any less clumsy (nor more, to be fair) = than calling isVirtual(). =20 $rProp =3D $rObject->getProperty('foo', $obj); $rProp->getValue(); // works always. if (!$rProp->isVirtual()) { $rProp->getRawValue(); // Works, may or may not be the same return a= s getValue() } vs. if (!$rProp instanceof VirtualProperty) { $rProp->getRawValue(); // Works. } That doesn't seem to be an improvement. If you omit the conditional, yo= u still need a catch one way or the other. It just changes what gets th= rown (an Exception vs an Error). What type of hierarchy were you thinki= ng of that would help here? --Larry Garfield