Re: Remove $this from incompatible context
| From: | Rowan Collins | Date: | Sun, 15 Feb 2015 18:09:54 +0000 |
| Subject: | Re: Remove $this from incompatible context | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-82734@lists.php.net to get a copy of this message | ||
On 14 February 2015 20:03:44 GMT, Marc Bennewitz <dev@mabe.berlin> wrote:
>Hi
>Am 13.02.2015 um 08:48 schrieb Stanislav Malyshev:
>> Hi!
>>
>>> there should be no bc break as the API doesn't change and the method
>>> produces the exact same result as before.
>> Sorry, this makes no sense to me. You claim that if you changed the
>> method code to do different thing it should continue working as if
>you
>> didn't change it? Why? I just don't get it.
>>
>>> It's not a good thing to magically change the method API in base of
>a
>>> method body that's not port of the API.
>> "magically change the method API"? What are you talking about? You
>> changed the code, not magic.
>>
>Sorry it wasn't clear. I hope I will now:
>
>The static modifier for methods is part of the method signature and
>method body isn't.
>(That's way interfaces doesn't describe method bodies but signatures)
>
>The static modifier defines a method as static and therefore defines
>the
>method is callable using "::".
More specifically, it defines that the method is *only* callable statically. There is currently no
opposite keyword to say that a method can only be called non-statically, but the absence of a
modifier has up until now meant that either call type is possible. An interface cannot currently
forbid static calls, only the use of $this.
Our choice is between keeping that ambiguity, and introducing a new rule that any method not marked
static must never be called statically (with provisos for technically non-static parent:: etc).
Regards,
--
Rowan Collins
[IMSoP]