| Article: |
Why PHP 5 Rocks! | |
| Subject: | some questions | |
| Date: | 2004-07-18 03:19:08 | |
| From: | riffraff | |
|
I never found this in php5 presentations: - are classes objects ? - are classes locked or open (like ruby,smalltalk)? - can you define your own metaclasses or - can you control the allocation+initialization of an object (like python,ruby,smalltalk) or just init like java? - can you do mixin programming in php5 ?
|
||
Showing messages 1 through 2 of 2.



PHP, and let's state that clearly, is not an object-oriented language _only_. The majority of its user base most probably does not use OOP. The new OO-features are a step forwards, but certainly a pragmatic user-focused one. Do not look for "highbrow" OO-theoretic stuff in PHP. Consequence: I could directly write a big NO as an overall answer here :)
# - are classes objects ?
There is no class "class", if you mean that. But with the new Reflection API and by the means of "$o = new $someClassName();" you should be able to do most of the things you could do with the class "class" in Java.
I think you could say there are no metaclasses.
# are classes locked or open (like ruby,smalltalk)?
I guess they're locked, I do no know of a way to alter a loaded class. Not sure if I understand the question, though.
# can you define your own metaclasses or
No metaclasses, I still think
# can you control the allocation+initialization of an object?
no. no object-oriented/-aware way to deal with things like memory usage and time consumption.
# can you do mixin programming in php5 ?
there's only "ordinary" inheritance.
# how good is the performance of runtime class checking of arguments to methods?
define "good" while I do a little benchmarking :)
# there are nifty tricks to make it faster than an attribute lookup at any call?
I did not understand this question? What do you refer to by "it"?