Re: [RFC] Union Types

From: Date: Sat, 16 Apr 2016 16:15:13 +0000
Subject: Re: [RFC] Union Types
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-92369@lists.php.net to get a copy of this message
Den 2016-04-14 kl. 16:25, skrev Levi Morrison:
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. Should the discussion phase lead to proposed conversion
rules in the RFC for scalar types or is it left for later? Regards //Björn

« previous php.internals (#92369) next »