Re: [RFC] Union Types
| From: | Levi Morrison | Date: | Thu, 14 Apr 2016 14:25:00 +0000 |
| Subject: | Re: [RFC] Union Types | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-92300@lists.php.net to get a copy of this message | ||
On Thu, Apr 14, 2016 at 3:12 AM, Derick Rethans <derick@php.net> wrote:
> On Wed, 13 Apr 2016, Levi Morrison wrote:
>
>> As alluded to in an earlier email today[1] I am now moving the Union
>> Types RFC[2] to the discussion phase. The short summary of the RFC is
>> that it permits a type declaration to be one of several enumerated
>> types. For example, this is a potential signature for a multi-type map
>> routine:
>>
>> function map(callable $f, Array | Traversable $iterable);
>
> I think what I am missing in the RFC is behaviour with scalar (weak)
> typehints, and which type the variable in a class would be converted to.
> Take for example:
This is not missing in the RFC; see the section called Weak Scalar
Types in Open Issues. However, it does not propose a solution. I have
been assured by a few people that it is possible and it is just
something that needs worked out.