Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120472 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 73049 invoked from network); 30 May 2023 17:15:18 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 30 May 2023 17:15:18 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0D083180555 for ; Tue, 30 May 2023 10:15:18 -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,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS29838 64.147.123.0/24 X-Spam-Virus: No X-Envelope-From: Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 30 May 2023 10:15:17 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 0D9C132009F2 for ; Tue, 30 May 2023 13:15:16 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute4.internal (MEProxy); Tue, 30 May 2023 13:15:17 -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:sender:subject :subject:to:to; s=fm1; t=1685466916; x=1685553316; bh=uitvXOWHef 9PPNwdyxZwjztwFrBrkqztHkarbzRkOqA=; b=JKf7TIuI+5U+HD7mhwtl7wxU/g k3HFi8ML5aElrnRyI2r4CyuX73ICUZhbkMYO7EetjGSR+j1MG6nhJs0q8AvFzN8h JyO7gIbq9zSe1J6Q2t0+2PvJUag39pbQNBg9tAcItLQbT5JcjO8T3/lbtKZoS4P5 TSD5EA4zwVQF8WKjlEZ+hpx+ikUcjKwSfgME2but1MQvnNei0E3yHRfEs+zcL7Xh a+8doUvsmB+hPppKwq0w54FEKfqpo1y8fO7xMMUy25HkvhBYct3S6FYv+jJ3E0lf zJDOyErDpZUnpgeIv+pH9bTkjH3FLpHf3Z1cKO+RXA8rJRXRGiZHz5PS6tdw== 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:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1685466916; x= 1685553316; bh=uitvXOWHef9PPNwdyxZwjztwFrBrkqztHkarbzRkOqA=; b=d Vs6Mm0lSq1nOVocOeABN/p+D2POzn77bdDrIK718MNGQDwAZcOB2Ydds+pVyI+s3 qjP3U+mmdp08kj7xtkMWmk0k2f4HF2PDkj65yy8A0xnUL222lE2B69yb25Q+lQva 6EoqD7KFHv5koNAyo4MyRws2YnEKrW70m4SmsOwHGu1174hqntHFDN1nc0MOLVWM 1gGtmHJsbS3taZ32JoWnYzWb00sNMBEz2JhvjAhLlWUFkHzsIpX2okGRjXVket99 fLW3QsdY+zb1o8/yv/e9wQITvX/uViUt3DSHH08G0PsXWQTVXUGcDNGPkKdLrrel bGd5PqPhKqs+f8KoEYosQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeekjedguddtlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdfn rghrrhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrd gtohhmqeenucggtffrrghtthgvrhhnpeeggeehgfetjeehgefggefhleeugefgtdejieev vdethfevgeeuudefleehvdetieenucffohhmrghinhepphhhphdrnhgvthenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghr fhhivghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 63E8E1700095; Tue, 30 May 2023 13:15:16 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-447-ge2460e13b3-fm-20230525.001-ge2460e13 Mime-Version: 1.0 Message-ID: <331a26ff-a11f-4a7e-b75b-5d588069aa5a@app.fastmail.com> In-Reply-To: <51D1B70D-D77A-40A1-8AE5-534E13C67CBB@gmail.com> References: <641b1ca0-d33f-4f38-ae64-81b4abce24da@app.fastmail.com> <51D1B70D-D77A-40A1-8AE5-534E13C67CBB@gmail.com> Date: Tue, 30 May 2023 17:14:53 +0000 To: "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Property hooks, nee accessors From: larry@garfieldtech.com ("Larry Garfield") --=20 Larry Garfield larry@garfieldtech.com On Mon, May 29, 2023, at 8:28 PM, Claude Pache wrote: >> Le 8 mai 2023 =C3=A0 23:38, Larry Garfield a= =C3=A9crit : >>=20 >> Ilija Tovilo and I would like to offer another RFC for your considera= tion. It's been a while in coming, and we've evolved the design quite a= bit just in the last week so if you saw an earlier draft of it in the p= ast few months, I would encourage you to read it over again to make sure= we're all on the same page. I'm actually pretty happy with where it en= ded up, even if it's not the original design. This approach eliminates = several hard-to-implement edge cases while still providing a lot of func= tionality in one package. >>=20 >> https://wiki.php.net/rfc/property-hooks >>=20 > > Hi, > > If I understand correctly, given: > > > class C { > > public int $someInt; > > public float $someFloat; > =20 > public int $someIntWithHook { > get =3D> $field; > set =3D> $field =3D $value; > } > > public float $someFloatWithHook { > get =3D> $field; > set =3D> $field =3D $value; > } > > } > ?> > > we have: > > $obj =3D new C; > var_dump($obj->someInt =3D 42.0); // int(42) > var_dump($obj->someFloat =3D 42); // float(42) > ?> > > but: > > $obj =3D new C; > var_dump($obj->someIntWithHook =3D 42.0); // float(42) > var_dump($obj->someFloatWithHook =3D 42); // int(42) > ?> > > If I am correct, it means that the =E2=80=9CThis also implies that add= ing a set=20 > hook to a property cannot change the result of the =3D operator=E2=80=9D=20 > statement is a bit too optimistic. We looked into this a bit; it's correct if you're in weak mode. In stri= ct mode, it applies only to $o->float =3D $anInt, as that's the only leg= al type coercion. Still, you're right that it's not quite "cannot chang= e", so I've adjusted the wording to better describe the edge cases. The= behavior is still the same as __set(), so we don't see a need to change= it further. Thanks for the catch. --Larry Garfield