Re: [RFC] [VOTE] Union types
| From: | Bob Weinand | Date: | Tue, 14 Jun 2016 16:36:23 +0000 |
| Subject: | Re: [RFC] [VOTE] Union types | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-93958@lists.php.net to get a copy of this message | ||
> Am 14.06.2016 um 18:09 schrieb Fleshgrinder <php@fleshgrinder.com>:
>
> On 6/14/2016 5:22 PM, Derick Rethans wrote:
>> Not clear on some of the wording. When you say:
>>
>> "This RFC proposes a vote on whether ?Foo shall be replaced by Foo |
>> null in general."
>>
>> Do you mean that ?Foo will no longer be allowed at all if this RFCs
>> passes?
>>
>> cheers,
>> Derick
>>
>
> Same question here, since
> https://wiki.php.net/rfc/nullable_types
> already passed and directly voiding it makes no sense.
>
> I mentioned this before but maybe it is better to change the RFC to
> disallow the question mark if an union type is in use:
>
> # OK
>
> ?string
> null|string
> string|null
>
> ?SomeClass
>
> SomeClass|SomeOtherClass|null
> null|SomeClass|SomeOtherClass
> SomeClass|null|SomeOtherClass
>
> # BAD
>
> ?SomeClass|SomeOtherClass
> ?SomeOtherClass|SomeClass
>
> ?string|int
> ?int|string
>
> This would be a perfectly valid and reasonable restriction that makes
> sense in every way because it helps to avoid ambiguity. However,
> disallowing ?T is not.
>
> --
> Richard "Fleshgrinder" Fussenegger
>
These last ones (which you describe as "BAD" are anyway disallowed.
The separate vote is to remove ?string by string | null as only option.
(It basically just preserves the concept of nullability, but reverses the decision to use a trailing
?. This vote is in order to give those who prefer only foo | null instead of ?foo a chance to voice
their opinion.)
Bob