Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120722 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 88257 invoked from network); 1 Jul 2023 19:18:18 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Jul 2023 19:18:18 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C54B91804F2 for ; Sat, 1 Jul 2023 12:18:17 -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=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 1 Jul 2023 12:18:17 -0700 (PDT) Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-4faaaa476a9so5009929e87.2 for ; Sat, 01 Jul 2023 12:18:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688239095; x=1690831095; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=GWy7MqWTPdfyIAKe8VOqcmwq0gD7gJ59gtkXWAN+zEY=; b=srjWGWBuwCty0up4Gn7IQERCkb196Nr6BZMZ00tU1tW9D+PIqMmey/jZR5FB7bXZZm vf5wiO4AeRhsWBqE8AXwsLpIYzbeYJdtb5ik2XnW2COIQL1lBieMSQXHP+qpa/q2PCtM uKL1OR0aTV3vu6x8jt1PUVdaZRR/P6XnsZciaKlua+VjmzZIsmOES8pOaV4m+qhqAlNs wNGbe+n0KgXJwjD1yLrEhR4Fm3MK4EqBJyooIaOSoBL3hVppsEIDWJo7gbQDiUEk5V6G 0MzxyDRQ212iW43PZsM9SGSMsoeD3ZIRwWu0ry63VLeS7aMT/lPZIwmuQz3kLV1n+tHA pO4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688239095; x=1690831095; h=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=GWy7MqWTPdfyIAKe8VOqcmwq0gD7gJ59gtkXWAN+zEY=; b=B4LrwsKuBdR30uBIJADtTMErWECs5whx/ijL9y6jbdWiwXo20pvMhXDe9tNW2+UNQS BlZzS5pbqM1O0HOF8FQTmj19QqT/nAmkekBXriojVTZRCBlXYcd8sB6MuNDoZRLi6KmV cVDax0UxKfLQEeRcEX9XAqLiIfsln98KcKFCAFDOZZmV5aTBtpnt3jN2e0K4rX5ZHN6S iLtLv4Kp5UFuZ6qTYgUOmZHQOOwKPzxZN7FF/JjA+IbUT6Bej48MJjHu6W8tjBFsH8Hw O3z7a/AjhB1eo8SXp9rbZgSvfIP+3q35sCSuRP4XU+3CMqo9f21UDnJkc2xHoM1k2Hen Jytg== X-Gm-Message-State: ABy/qLbbQSxA7BhN6FUUqW/tW0XkcV7Pr5TEkt48zEeacm1cySC2AlZk nTHyJd/I4zgCS/uj4Ya/TY7j431D42cbU0lo6+cb1OZVphM= X-Google-Smtp-Source: APBJJlFsQjmTz7Sia5BPD6pTG0DSbeWVNCOJ/ZnxW7+v17WAzMuUUeVudKmu9h5lL00izhNzx/4mnQxMqP0svsTAORc= X-Received: by 2002:a05:6512:619:b0:4f6:3000:94a0 with SMTP id b25-20020a056512061900b004f6300094a0mr4045696lfe.61.1688239094610; Sat, 01 Jul 2023 12:18:14 -0700 (PDT) MIME-Version: 1.0 References: <641b1ca0-d33f-4f38-ae64-81b4abce24da@app.fastmail.com> <51D1B70D-D77A-40A1-8AE5-534E13C67CBB@gmail.com> <331a26ff-a11f-4a7e-b75b-5d588069aa5a@app.fastmail.com> In-Reply-To: <331a26ff-a11f-4a7e-b75b-5d588069aa5a@app.fastmail.com> Date: Sat, 1 Jul 2023 16:17:38 -0300 Message-ID: To: php internals Content-Type: multipart/alternative; boundary="00000000000087bfc805ff71cb8e" Subject: Re: [PHP-DEV] [RFC] Property hooks, nee accessors From: ericklima.comp@gmail.com (Erick de Azevedo Lima) --00000000000087bfc805ff71cb8e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hey everyone. Any news on this? I'm really excited about this one. =3D) -- Erick de Azevedo Lima Em ter., 30 de mai. de 2023 =C3=A0s 14:15, Larry Garfield escreveu: > > > -- > 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 > : > >> > >> Ilija Tovilo and I would like to offer another RFC for your > consideration. 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 past 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 > ended up, even if it's not the original design. This approach eliminates > several hard-to-implement edge cases while still providing a lot of > functionality in one package. > >> > >> https://wiki.php.net/rfc/property-hooks > >> > > > > Hi, > > > > If I understand correctly, given: > > > > > > > class C { > > > > public int $someInt; > > > > public float $someFloat; > > > > 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 addi= ng a set > > hook to a property cannot change the result of the =3D operator=E2=80= =9D > > statement is a bit too optimistic. > > We looked into this a bit; it's correct if you're in weak mode. In stric= t > mode, it applies only to $o->float =3D $anInt, as that's the only legal t= ype > coercion. Still, you're right that it's not quite "cannot change", 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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --00000000000087bfc805ff71cb8e--