Internals,
Joe Watkins and Bob Weinand have worked out a proof-of-concept patch for union types. 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
andfalse
for type declarations. - This patch includes conversion rules for weak types.
- It does not have short-hand for unions with null (
?Foo
beingFoo | 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.