On Mon, Aug 29, 2016 at 7:36 AM, Igor Inas <igor.i...@gmail.com> wrote: > Hello, > > same as last post in the mailing list - this may have been suggested before > - but I had hard time finding it in the archives. > > Coming from static typed languages, I love the addition of return type > annotations and extension of parameter type annotations. I also love the > fact, that types are not nullable by default. > > I am reading about the proposal to add nullable types before union types > are fully implemented. This would be done by utilizing question mark (int? > / ?int). > > My question is: would it be too difficult to implement nullable types using > syntax of union types, but semantically, only max two types would be > allowed in the union and one of them would have to be null. So only allowed > forms would be: > - int | null > - null | int > > I am thinking about the future, when union types become implemented and > suddenly there would be two ways how to annotate the same nullable type: > - int | null > - int? > > Thanks for more insights, > Regards, > Igor
The union types RFC did not get enough support to pass. Additionally having two forms of syntax to do the same thing is not the worst thing that can happen in language design. They would at least be semantically equivalent which is the important thing. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php