Regarding new functionality.
| From: | Silviu Lucian Văcăroiu | Date: | Mon, 24 Oct 2005 09:56:19 +0000 |
| Subject: | Regarding new functionality. | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-29636@lists.php.net to get a copy of this message | ||
Hello,
First of all sorry if I've sent this email to the wrong address, but reading
the contact page in PHP.net I couldn't figure out where the best place for
such a query would be.
Okay. well here it goes.
I've been writing software in PHP since my high school freshman years - now
in the second year of college I'm even earning a fair living writing PHP
code. I come from a background of C++ and Java, as such I miss the entire
OOP paradigm in PHP.
Sure, one could argue that PHP support OOP to some level . and that it does
very well, but to a very restricted level. To that extends there doesn't
seem to be any way of overloading the '[ ]', '+', '-', etc. operators;
another minus for PHPs OOP approach is the use of 'utility functions' for
database connectivity, file operations, etc. when all this functionality
could be grouped in classes.
Sure, one could write ones classes as wrappers for these utility functions.
But lets assume one would want to extend the functionality of Hash Maps or
Arrays to some extent . one could not override the '[ ]' operator (for
example). Yes , for such a class, one could provide a 'public 0function
index( $index ) { return $this->a[$index]; }' but that makes for some quirky
code when one has to explicitly call member functions just to call an index
from a hash/array.
Another problem I seem to have, relating to the OOP approach in PHP, is with
Expat XML parsing. If I have an object that at some point (in a member
function) should parse an xml file . I can't, for the life of me, seem to
register callbacks found within that object. I must provide functions that
are exterior to that object, or else xml_parse won't be able to call them.
That again makes for terribly quirky code.
Clear as mud? Let me know.
Will PHP ever grow out of this 'young' oop approach? Or am I missing
something regarding the functionality I've mentioned?
Sincerely,
Silviu Lucian
PS: please excuse my english