Re: [RFC] Typed Properties
| From: | Stephen Reay | Date: | Thu, 21 Jun 2018 15:32:35 +0000 |
| Subject: | Re: [RFC] Typed Properties | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-102349@lists.php.net to get a copy of this message | ||
> On 21 Jun 2018, at 4:59 am, 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
Hi Nikita/Bob,
I’m *really* happy to see someone taking another stab at this.
My only ‘input’ as such, is around the decision to omit
callable. Given that we
*have* Closures (thus allowing a developer to explicitly state that they want something they can
invoke regardless of context, if they so wish), I think callable should be a valid type
for properties too. The language doesn’t prevent floating point math because you might not get the
result you expect - it simply documents and warns people that they need to be aware of some inherent
attributes of the feature.
Whether that particular aspect of the RFC changes or not, again, thank you both for working on this!
Cheers
Stephen