Re: [RFC] Nullable Types

From: Date: Thu, 14 Apr 2016 07:50:12 +0000
Subject: Re: [RFC] Nullable Types
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-92276@lists.php.net to get a copy of this message
On 04/14/2016 06:42 AM, Levi Morrison wrote:
As alluded to in an earlier email today[1] I am now moving the Nullable Types RFC[2] to the discussion phase. In a nutshell this RFC proposes syntax for declaring a type to alternatively be null. +1
The up to date implementation for return-type-hints may be found at https://github.com/php/php-src/pull/1851/files Implementation for argument-type-hints is really not a problem
There is a decision that needs to be made: does the question mark go before or after the type name?
     function (?Foo $foo);
     function (Foo? $foo);
There are precedents in several languages for each position. Some relevant issues to where the question mark goes are noted in the RFC[3].
It's better to use ? position before the type, to reduce fragmentation with HHVM. Thanks. Dmitry.
I look forward to a helpful and meaningful discussion! [1]: http://news.php.net/php.internals/92252 [2]: https://wiki.php.net/rfc/nullable_types [3]: https://wiki.php.net/rfc/nullable_types#position_of


« previous php.internals (#92276) next »