I think this will add more complexity to the runtime system. The type hinting will be something we use to generate good JIT code, not just for checking types.
Dmitry Stogov <dmi...@zend.com> 於 2016年4月14日 星期四寫道: > The RFC doesn't say anything about support for multiple class names. > > function foo(A|B|C $x) > > Support for multiple classes would lead to complex implementation. > > Thanks. Dmitry. > > ________________________________________ > From: Levi Morrison <morrison.l...@gmail.com <javascript:;>> > Sent: Thursday, April 14, 2016 06:46 > To: internals > Subject: [PHP-DEV] [RFC] Union Types > > As alluded to in an earlier email today[1] I am now moving the Union > Types RFC[2] to the discussion phase. The short summary of the RFC is > that it permits a type declaration to be one of several enumerated > types. For example, this is a potential signature for a multi-type map > routine: > > function map(callable $f, Array | Traversable $iterable); > > The second parameter `$iterable` is required to be of type Array or > Traversable - any other type will error. > > I look forward to a helpful and meaningful discussion! > > [1]: http://news.php.net/php.internals/92252 > [2]: https://wiki.php.net/rfc/union_types > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Sent from Gmail Mobile