That's right. And that's exactly why it's such a bad idea to call it
static::. It's the scope resolution operator which already makes them
static, not their name. (I'm sorry for catching you on your words ;) )


I agree that it is not the best name, just not as bad as some of the others.
:)

That's not right. Accessing the child class would only be possible from
within an instantiated object. Unlike parent::, you will never be able
to use static:: in a purely static context. Imagine there are multiple
child classes which all inherit from the same base class. If there's no
instance, PHP won't be able to know which child class to target with
child::, static:: or whateverkeyword:: since it can be any one of those
child classes.


I agree. When I made my first post, I had not made this consideration.

Since there's no use for it in a static context anyway, I think
static::, child:: or whateverkeyword:: would be confusing for
developers. Since this would only work from withing an instance, I
thought it might be a better idea to make static members accessible
through $this->. (I think I even expected this to work when I first
found out it didn't ;) )


For the sake of argument, let's say that php did this; then anytime you
needed this functionality, it would only be available in instantiated
objects. That is a pretty limiting feature, and to me it would be
meaningless. I say it is meaningless because if you instantiate an object,
you can do a set up in the constructor to tell the parent what it needs to
know without the late static binding. It may not be the perfect solution,
but it would also be very far from a kludge at the same time. But, on the
huge downside, this functionality would be lost on static methods and
properties, where I feel it would be at the greatest benefit.

Honestly, I admit that I am not as smart as these guys who built -- and
continue to build -- PHP. I personally have no further suggestions on what
to do about this problem, but I want thank everybody for their time -- and
indulgences -- in listening to me and educating me. I will continue to watch
this forum so I can learn more. Have a great weekend everybody! :)

--
It looked like something resembling white marble, which was
probably what it was: something resembling white marble.
               -- Douglas Adams, "The Hitchhikers Guide to the Galaxy"

Reply via email to