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.

Regards,
--
Rowan Collins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to