Hello internals,
right now we allow 'class::method()' like syntax but not 'class->method()
like. If noone comes up with a valid reason why i am forced to call
a parents method using static syntax i'll commit the little required
change. We could even add an E_STRICT
when the old syntax is used where
not applicable. But right now i don't see that message as neccessary
unless people want to disallow misuse of the old synatx any time later.
Best regards,
Marcus
Yes, this was by design. Via class it should be ::method() and via
object it should be ->method().
Why do you think this is wrong? I think it actually makes a lot of
sense and don't see what we gain from allowing to call
self->method(). If there's a good reason, I'd be open to it though.
And please next time give people a chance to reply to your email,
especially on a weekend, before commiting a patch. Why do you send an
email if you don't want to hear an answer?
Andi
At 10:32 AM 1/22/2006, Marcus Boerger wrote:
Hello internals,
right now we allow 'class::method()' like syntax but not 'class->method()
like. If noone comes up with a valid reason why i am forced to call
a parents method using static syntax i'll commit the little required
change. We could even add anE_STRICT
when the old syntax is used where
not applicable. But right now i don't see that message as neccessary
unless people want to disallow misuse of the old synatx any time later.Best regards,
Marcus
Andi Gutmans wrote:
Yes, this was by design. Via class it should be ::method() and via
object it should be ->method().
Why do you think this is wrong? I think it actually makes a lot of sense
and don't see what we gain from allowing to call self->method(). If
there's a good reason, I'd be open to it though.
I just gave a course in PHP5 OOP and this syntax overlap with static
calls that do not end up being static seems confusing.
If I get Marcus proposal properly he would then allow changing things from:
parent::method();
to
parent->method();
This would add a totally separate syntax, which would make it clear to
users that this is in fact not a static call. It looks ugly, but I
understand what he is aiming at.
regards,
Lukas
Lukas Smith schrieb:
If I get Marcus proposal properly he would then allow changing things
from:
parent::method();to
parent->method();
If that is the case, then it would be consistent to allow
this->method()
this->attribute
parent->attribute
too, no? (Note that I am not advocating the above, I am just being
curious about consistency issues.)
--
Sebastian Bergmann http://www.sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69
Hello Andi, Sebastian,
Monday, January 23, 2006, 9:25:29 AM, Sebastian wrote:
Lukas Smith schrieb:
If I get Marcus proposal properly he would then allow changing things
from:
parent::method();to
parent->method();
If that is the case, then it would be consistent to allow
this->method()
this->attribute
parent->attribute
parent->method() would work
attributes are more than discussable and i don'T think we need anything
more than $this->attibute for dynamic attibutes. And since you cannot
overload protected or public attibutes or hide base class attibutes there
is no need to provide a means of skipping hierarchy levels.
If i was very pedantic i'd not propose 'baseclass->method()' but the
formal correct '$this->baseclass::method()'. However i see the former as
a very handy and clear shortcut. Another reason to go with the shortcut
is that once we'd allow '$this->baseclass::method()' people would start
to ask for '$obj->classname::method()' which is at somepoints usefull
but is not exactly the KISS approach.
Best regards,
Marcus
As you're using this in the context of the object, I don't think it's
too confusing. I actually find the latter more confusing and think
it's best to stick to what we have today.
Andi
At 12:08 AM 1/23/2006, Lukas Smith wrote:
Andi Gutmans wrote:
Yes, this was by design. Via class it should be ::method() and via
object it should be ->method().
Why do you think this is wrong? I think it actually makes a lot of
sense and don't see what we gain from allowing to call
self->method(). If there's a good reason, I'd be open to it though.I just gave a course in PHP5 OOP and this syntax overlap with static
calls that do not end up being static seems confusing.If I get Marcus proposal properly he would then allow changing things from:
parent::method();
to
parent->method();
This would add a totally separate syntax, which would make it clear
to users that this is in fact not a static call. It looks ugly, but
I understand what he is aiming at.regards,
Lukas