On Thu, Jul 16, 2015 at 9:42 AM, Rowan Collins <rowan.coll...@gmail.com> wrote: > Levi Morrison wrote on 16/07/2015 16:23: > >> People have talked about creating types like so: >> >> type Iterable = array | Traversable; >> >> which could then be used as normal: >> >> function foo(Iterable $f); > > > I kind of like this idea. > >> Why special case a pseudo-type if we can have a generic >> way of making them in user-land? > > > Well, for the same reason as large amounts of the core library exist (and > PHP's is small compared to some): standardisation and ease of use. I think > "array | Traversable" is a common enough use-case that it deserves a > built-in name, even if a userland naming system is available.
I assume if `type Iterable = array | Traversable` can be built in user-land then it will be done using the same mechanisms in core (meaning it wouldn't be a special case or one-off type). -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php