Re: Remove $this from incompatible context
| From: | Rowan Collins | Date: | Mon, 16 Feb 2015 10:28:00 +0000 |
| Subject: | Re: Remove $this from incompatible context | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-82807@lists.php.net to get a copy of this message | ||
Stanislav Malyshev wrote on 16/02/2015 05:14:
Hi!Well, no, it would mean "you cannot call this method statically, even if it doesn't use $this", i.e. the same meaning proposed for any method that omits the keyword "static". By your reasoning, you could say that adding "static" just means "foo() method doesn't use $this". The point is that you're making an explicit choice one way or another, and the version with neither annotation remains ambiguous. Regards, -- Rowan Collins [IMSoP]Agreed. Personally, I'm a great fan of symettry, so part of me would prefer to introduce a keyword for when you *can't* call a method statically, e.g. "instance function foo() { ... }". But I guess instanceThis would be another form of saying "foo() method uses $this", but if that's true then once it uses $this you'd get the error anyway, so not much changes from adding "instance".