I must admit with embarrassment that after months of googling and posting 
questions to various forums I still fail to understand the purpose of the 
"insteadof" keyword and the insteadof clause.

As I currently see it, the whole insteadof clause is completely redundant. In 
a clause like this:

Foo::tweak insteadof Bar;

the "insteadof Bar" part does not specify any information that is not already 
unambiguously specified by the "Foo::tweak" part. "Foo::tweak;" already 
conveys the intention of using tweak from the trait Foo instead of any other 
trait that has a member named tweak. What if we are using seven such traits? 
Do we have to list them all after insteadof? Why do we have to explicitly 
enumerate things that we DON'T want to use?

I would like to see a small code example where the insteadof clause provides  
information that is BOTH necessary to make the program unambiguous AND cannot 
be conveyed with the simple "Foo::tweak;" syntax. Absent such example, I 
consider "insteadof" harmful because it does nothing and adds a maintenance 
chore. It should be made optional and deprecated ASAP, and removed at some 
point in the future.

Szczepan Hołyszewski

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to