Edit report at https://bugs.php.net/bug.php?id=53081&edit=1
ID: 53081
Comment by: keith at madsync dot com
Reported by: giorgio dot liscio at email dot it
Summary: why you should bring back abstract static methods
Status: Not a bug
Type: Feature/Change Request
Package: Class/Object related
PHP Version: 5.3.3
Block user comment: N
Private report: N
New Comment:
"abstract" means required implementation by subclasses, "static" means declared
on the class. ignoring the internals of php's construction for a moment, and
how difficult proper implementation of the feature might be, these are
orthogonal concepts. "abstract static function X" means "classes extending this
one must declare static method X."
right now in order to enforce a static contract, i have to use an interface
*and* an abstract class. this means more code and more distributed
functionality in my codebase. worse, i have to remember to implement the
interface on every child class, which almost defeats the purpose of having the
interface in the first place - "class A extends Letter implements IAlphabet +
abstract class Letter" rather than "class A extends Letter + abstract class
Letter implements IAlphabet." and the only purpose of IAlphabet is to enforce
that A contains some static method? ugh. that should be Letter's job, it's
why i made it abstract in the first place.
allowing static and abstract to work together as the orthogonal concepts they
are leads to simpler, more readable, better-distributed code, and doesn't
require i instantiate objects for functionality not related to object state.
the fact that the static method on the parent class is not a part of the
child's inheritance seems to me irrelevant. please include this feature again
in future releases.
Previous Comments:
------------------------------------------------------------------------
[2013-01-08 23:18:13] jon at langevin dot me
Valid issue, please re-classify as a bug. This is not a feature request.
------------------------------------------------------------------------
[2012-01-19 18:20:39] andy at andy-burton dot co dot uk
Still get strict warning in 5.3.2 - static abstract classes in 5.3 make perfect
sense to me, no idea why this is flagged as bogus!
------------------------------------------------------------------------
[2010-11-14 19:10:34] giorgio dot liscio at email dot it
...
------------------------------------------------------------------------
[2010-10-20 16:47:42] giorgio dot liscio at email dot it
i know... could someone analyze my request please? i know that a lot of bug
reports are bogus, but not all
------------------------------------------------------------------------
[2010-10-17 13:59:48] cmanley at xs4all dot nl
Georgio,
Your example makes perfect sense. I just wish the bug handlers wouldn't be so
rude
as to flag valid reports as bogus when users spend effort to report these bugs
with examples.
There's nothing bad about having abstract static methods in a language that
finally supports static inheritance (since PHP 5.3). This is normal practice in
other languages too so E_STRICT shouldn't be emitted.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=53081
--
Edit this bug report at https://bugs.php.net/bug.php?id=53081&edit=1