Re: [RFC] Patch for Union and Intersection Types
| From: | Joe Watkins | Date: | Tue, 26 Apr 2016 14:13:07 +0000 |
| Subject: | Re: [RFC] Patch for Union and Intersection Types | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-92779@lists.php.net to get a copy of this message | ||
Afternoon Dmitry,
I started the implementation of this because unions and nullables
appears to be in my way (typed properties).
At no point did Levi request an implementation. I decided, selfishly,
to provide one because it's in my way, and we've been waiting so long
already.
There is no conspiracy.
I would actually like it if nullable types came first, I would have
preferred not to have my work on typed properties stopped also.
We don't always get what we want :)
Cheers
Joe
On Tue, Apr 26, 2016 at 2:33 PM, Dmitry Stogov <dmitry@zend.com> wrote:
> hi Levi,
>
> It looks like your "work" on "Nullable Types" RFC was intended to win time
> for this patch and block "Nullable Types" again.
> Actually, you have been blocking it for more than a year :(
>
> I'm going to push my own RFC for voting together with "Union Types".
>
> https://wiki.php.net/rfc/nullable_return_types
>
> At least, it has up to date implementation.
>
> We discussed this internally 2-3 weeks ago, and my politeness (or/and
> stupidity) allowed you to pass your version for common discussion.
> Now I can see your real reason :(
>
> Both "Union Types" and "Nullable Types" may make sense, and both should be
> voted at the same time.
> Tomorrow is time to start voting. Right?
>
> Thanks. Dmitry.
>
>
> ________________________________________
> From: Levi Morrison <morrison.levi@gmail.com>
> Sent: Tuesday, April 26, 2016 02:37
> To: internals
> Subject: [PHP-DEV] [RFC] Patch for Union and Intersection Types
>
> Internals,
>
> Joe Watkins and Bob Weinand have worked out a [proof-of-concept patch
> for union types][1]. Please go download it and experiment with it.
>
> A few things to note:
>
> * This patch includes intersection types. However, a type expression
> must be either a union type or an intersection type; it doesn't
> support both such as
Array | (Countable & Traversable).
> * This patch adds null, true
> and false for type declarations.
> * This patch includes conversion rules for weak types.
> * It does not have short-hand for unions with null (?Foo
> being `Foo |
> Null`)
>
> These features (or omitted ones) are not necessarily what will be
> voted on. Rather this patch allows us to experiment with these
> features in code. This experience should be helpful for us to solidify
> how we actually feel about these features.
>
> I especially would like people to try out the conversion rules for
> scalar types as it has been a point of discussion.
>
> [1]: https://github.com/php/php-src/pull/1887
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>