Re: [RFC[ Property accessor hooks, take 2
| From: | Gina P. Banyard | Date: | Wed, 28 Feb 2024 15:16:37 +0000 |
| Subject: | Re: [RFC[ Property accessor hooks, take 2 | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-122533@lists.php.net to get a copy of this message | ||
On Tuesday, 27 February 2024 at 23:17, Larry Garfield <larry@garfieldtech.com> wrote:
> I genuinely don't understand the pushback on $value. It's something you learn once
> and never have to think about again. It's consistent.
>
> Ilija jokingly suggested making it always $value, unconditionally, and allowing only the type
> to be specified if widening:
>
> public int $foo { set(int|float) => floor($value); }
>
>
> Though I suspect that won't go over well, either. :-)
Same, I don't understand the pushback on $value, for me this seems clearer and less confusing
than the existing $this variable when I was first learning about OOP.
And I would be in favour of just making it always $value, if people feel that strongly about being
able to name it with a custom name they could propose this as a follow-up RFC.
One thing the RFC should note, which I would expect to be the same as the array cast, is how do
backed/virtual properties interact with get_mangled_object_vars()
Best regards,
Gina P. Banyard