It looks great!

Thank you so, so much. I've been wanting this for a long time. I have used
properties in C# and it's very useful. I'm reading this RFC since it was in
draft. =)
One thing that I did not understand was this piece of code:

class C {
    public array $_names;
    public string $names {
        set {
            $this->*_prop* = explode(',', $value); // *<---- Where this
"_prop" is coming from?*
        }
    }
}
$c = new C();
var_dump($c->names = 'Ilija,Larry'); // 'Ilija,Larry'
var_dump($c->_names); // ['Ilija', 'Larry']

Does "_prop" have any special meaning or is it just a typo?

Thanks one more time for this!

Regards,
Erick

Em ter., 9 de mai. de 2023 às 08:52, Dik Takken <dik.tak...@gmail.com>
escreveu:

>
>
> On 08-05-2023 23:38, Larry Garfield wrote:
> > 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
> >
>
> Thanks for all the work that has gone into this. It looks great. The
> ability to add properties to interfaces is also really nice.
>
> One thing that concerns me is the following: "the use of [] on any
> property (with or without a key) will result in a runtime error being
> thrown". While the intent of the RFC is to allow adding hooks without
> causing BC breaks, this detail does introduce a BC break. And the break
> may get introduced without realizing it.
>
> I'm not sure which solution would be best here: Just accept the
> limitations for arrays (same as for list properties in Python) or forbid
> the use of hooks for array properties? I'm leaning towards accepting the
> limitations, like Python does. Then it is up to the API designer to
> decide if a property hook is the right tool for the job or not.
>
> Regards,
> Dik
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: https://www.php.net/unsub.php
>
>

Reply via email to