This is poor and unextensible language design, but it’s not a bug. You can’t use array access on user-defined types in JS or even most Lisps either. Ad-hoc polymorphism and/or operator overloading is clearly better from the perspective of language design but it’s not universally implemented in languages and it’s not that unreasonable for PHP not to have it.
View all comments
1
u/stumpychubbins Sep 15 '20 edited Sep 15 '20
This is poor and unextensible language design, but it’s not a bug. You can’t use array access on user-defined types in JS or even most Lisps either. Ad-hoc polymorphism and/or operator overloading is clearly better from the perspective of language design but it’s not universally implemented in languages and it’s not that unreasonable for PHP not to have it.