>> Especially if the ability was afforded to arrays as well (function
>> foo(array<Bar> $array){})...
>
> This would require O(n) runtime tests, I would definitely not go there.

Actually, it does not require O(n) runtime tests.  The solution is
simple: store the type when it is created. Whenever an element is
added, make sure it matches the correct type.  All this does is add
some flat overhead.

I am also supportive of the idea of having generics, but I am not sure
that the work it would take is worth it.

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

Reply via email to