[RFC] Patch for Union and Intersection Types
| From: | Levi Morrison | Date: | Mon, 25 Apr 2016 23:37:05 +0000 |
| Subject: | [RFC] Patch for Union and Intersection Types | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-92759@lists.php.net to get a copy of this message | ||
Internals,
Joe Watkins and Bob Weinand have worked out a [proof-of-concept patch
for union types][1]. Please go download it and experiment with it.
A few things to note:
* This patch includes intersection types. However, a type expression
must be either a union type or an intersection type; it doesn't
support both such as
Array | (Countable & Traversable).
* This patch adds null, true and false for type
declarations.
* This patch includes conversion rules for weak types.
* It does not have short-hand for unions with null (?Foo being Foo |
Null)
These features (or omitted ones) are not necessarily what will be
voted on. Rather this patch allows us to experiment with these
features in code. This experience should be helpful for us to solidify
how we actually feel about these features.
I especially would like people to try out the conversion rules for
scalar types as it has been a point of discussion.
[1]: https://github.com/php/php-src/pull/1887