i like php but it does need better syntax to be more competitive against other syntactic sugar style scripting languages like Perl or Ruby. for once, rather than relying on a million functions for handling what should be more embedded capabilities. for instance, arrays and associative arrays really need to be revamped. it's something that i really like about Perl in how hashes and arrays having some qualities that allow for nicer formatting of code.
another thing that i think PHP should do is remove interfaces and go with multiple inheritance. i really see no point in PHP using interfaces. I find interfaces to be useful in heavily typed languages. in the case of Java, for instance, interfaces work because you need to specify a return type and the elements in the interface must be specific. Interfaces in PHP to me have no meaning because you're just being forced to implement a function with a meaningless signature. the signature can contain anything without enforcement. so how can you utilize that as an ADT? you're really better off with an abstract class at this point. if PHP wants to improve the use of interfaces, i suggest enforcing a return type and making the signature of the interface heavily typed. otherwise, you'll never see someone like me employ an interface directly in his code.
Multiple inheritance for me is more important. i hit a situation the other day where i could've used multiple inheritance. i had code duplication in two classes that performed similar functions. i would've encounted the diamond inheritance problem because of the way i would've inherited in this case. however, the only way to prevent this duplication of code would've been to do an inline require_once statement. still not really an object-oriented way to go about solving a problem!
Trackbacks: (Trackback URL)