Re: Well zeev, hereby:-)
| From: | Zeev Suraski | Date: | Mon, 17 Jul 2000 16:16:51 +0000 |
| Subject: | Re: Well zeev, hereby:-) | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-24784@lists.php.net to get a copy of this message | ||
At 12:48 17-07-00, Kristian Köhntopp wrote:
Well, the object system in PHP currently is a mess: Classes are not types, they are just hashes with functions. Some people are currently using functionless objects as fancy array syntax, writing $o->a instead of $o["a"]. This very elegantly combines the ineffiency of objects with the lack of the ability to use array functions on them.Objects in PHP behave like they should in a loosely typed language, in my opinion. They're not *supposed* to be anything beyond a collection of data linked with a set of methods that's relevant to that data.
Also, references are needed to deal properly with objects, and object networks (data structures made from objects, hashes, arrays and other container types). Additionally, ctors and dtors are handled in a suboptimal fashion or are even lacking completely.It's been a while since I said it, but the reference system in PHP will never change to allow 'data structures'. Loosely-typed, automated languages simply don't do this job too well, and they shouldn't do it either. For example, circular references are something you *CANNOT* solve (for all practical purposes, if you care about speed), which is one of the most basic building blocks of data structures. If you consider the circular reference problem as a problem that is here to stay (which it is) - you can understand yourself that what you're talking about is science fiction. Constructors can indeed be optimized (speed wise, I disagree with you regarding about their naming convention which will definitely not change), and we'll do that at some point in the future. Destructors will never be introduced to PHP for technical reasons - there's *NO* right place in which you can call a destructor. I've explained this numerous times in the past.
Although a mess, the current object system is a great improvement over the PHP3 non-object system: Even if not first class citizens, we do have references, and we do have an introspection API which is mostly complete, even if somewhat asystematically organized. I think the PHP object system should be fixed, and this can only be done with either breaking compatibility or by creating a second new object system with a different syntax.Neither should (and as far as I can tell, would) happen. I respect the large amount of hard work you put into developing frameworks such as PHPlib, and can understand why you want PHP to be more similar to languages such as Java, but you have to realize that most PHP people will not sympathize with your needs, if it means making PHP more strongly-typed and less dynamic. Breaking compatibility is not an option, and as far as I'm concerned, neither is introducing a new object layer, which would go against the 'theme' of PHP. Zeev -- Zeev Suraski <zeev@zend.com> http://www.zend.com/