Robert Klemme wrote:
> On 22.06.2009 21:22, Alexander Trauzzi wrote:
> 
>> It was recently implemented in PHP as "late static binding" (as "self" 
>> references the class in which it is used, as opposed to the context 
>> during the invocation itself).
> 
> Did you mean "defined" instead of "used"?  Otherwise I cannot make much
> sense of what you write.
> 
>> From what I'm reading here, "ruby does it right"(tm?)
> 
> Yes - of course! :-)
> 
>> Thanks for all your help guys, I will follow up in a new topic if I have 
>> any further questions.
> 
> You're very welcome.
> 
> Kind regards
> 
>   robert

Just to clarify:

Simple example (language agnostic):

o Class Animal
  - Method eat()
o Class Cat Extends Animal


In PHP, what would happen is if you used "self" in Animal.eat, it would 
always resolve the class to be Animal (which is just silly).  PHP seemed 
to look up against the source file, rather than the inheritance tree.
Then, in a recent release, they introduced late static binding and a 
smattering of functions and keywords for it, which opened up the 
opportunities for classes to reflect on themselves after being extended.

Its still not perfect, and I can see that Ruby has made more progress in 
the realm of good OO behaviour.

Hopefully that helps, just from an academic standpoint ;)
-- 
Posted via http://www.ruby-forum.com/.