Re: [RFC] Typed Properties

From: Date: Wed, 20 Jun 2018 23:10:23 +0000
Subject: Re: [RFC] Typed Properties
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-102334@lists.php.net to get a copy of this message
Hi Nikita, Bob, On Wed, 20 Jun 2018, 23:59 Nikita Popov, <nikita.ppv@gmail.com> wrote: > Hi internals, > > Bob and I would like to present a new typed properties proposal for your > consideration: > > https://wiki.php.net/rfc/typed_properties_v2 > > The proposal allows you to annotate properties with types, which are > enforced at runtime. Unlike the previous RFC on this topic, the new > proposal also supports typed static properties and references to typed > properties. > > Please note that next to the main body, the RFC also contains an > "Alternatives" section, which explores the problem space and considers > trade-offs of different behaviors in some detail. > > Finally, while this RFC currently targets PHP 7.3, this is a large and > complex proposal and we may not be able to meet the deadline, in which case > this feature will go into the next PHP version. > > Regards, > Nikita > This is awesome news! I skimmed over the proposal and it is extremely well thought out, and almost everything that was causing a -1 on the previous RFC is gone: kudos! The last bit that is missing is the __get kink, mostly because __get() is "squishy by design". Still, the fact that references are properly typed mitigates the issue for my shady use-cases (I've got a reputation there), so I'm quite happy with an implicit magic type check. One thing I couldn't find is whether this magic check is also enforced when calling __get() explicitly, and not via the guards in the engine. Is the current development branch usable for testing something locally? I can't see any obvious mistakes here, but I just wanted to try this out with some of the more obscure libraries that touch property state at the level that is covered by this RFC. >

« previous php.internals (#102334) next »