Lazare Inepologlou wrote on 27/11/2014 10:35:
2014-11-27 4:47 GMT+01:00 guilhermebla...@gmail.com <
guilhermebla...@gmail.com>:

Hi,

I worked on an implementation of a somehow controversial concept that
exists in hack and C#: abstract final classes.

https://wiki.php.net/rfc/abstract_final_class

My motivation is to further expand class support to add modifiers (PPP -
public, protected, private). I added this change to initially segregate
grammar rules. It was an easy feature without extensive complexity and
covers some use-cases.


"Abstract final" is a strange way to name it. What you want is a "static"
class:

* The fact that one cannot initialise an abstract class is only a side
effect. Abstract classes are meant to be used for inheritance.

* Abstract static methods are not possible (one more reason why abstract is
a bad name).

* A "static" class does not have to be final, given the fact that PHP is
one of the few languages that offer a robust Late Static Binding.

This has always been my feeling. To me, "abstract" means "must be extended", and "final" means "can't be extended", so combining the two seems like a self-contradiction.

The fact that abstract classes allow static methods to be called without sub-classing always seems a bit odd to me - it's as though only the constructor is really abstract, not the whole class.

A "static" class, however, whether "final" or not, is definitely something I've wanted.

Regards,
--
Rowan Collins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to