On Sat, Apr 24, 2021 at 12:55 PM Saif Eddin Gmati <azj...@protonmail.com> wrote:
> Hello Internals, > > I'm sending this email to open discussion about sealed classes, > interfaces, and traits feature for PHP 8.1. > > I have create a Draft RFC here: https://wiki.php.net/rfc/sealed_classes > > A major concern for few people have been the syntax, in which it > introduces 2 new keywords into the languages, therefor, i have added a > section about alternative syntax which could be used to avoid this problem. > > Regards, > > Saif. > Hello, To me the first sentence of the RFC is debatable: > The purpose of inheritance is code reuse, for when you have a class that shares common functionality, and you want others to be able to extend it and make use of this functionality in their own class. That sounds like [abstract] base classes, which certainly permit that, but I wouldn't state that "the purpose" of [designing] class hierarchies is "code reuse", which can also (better?) be achieved with traits or even simply composition (by the way, the introduction then mentions that "PHP has the `Throwable` interface, which defines common functionality between `Error` and `Exception` and is implemented by both", but there is no "code reuse" in an interface). I also agree with others that Shape is probably not a good example, and the ResultInterface example feels like an enum/ADT (and the FilesystemTrait example I guess is to replace `@internal` phpDoc). I'm not saying that this RFC is bad, but probably not as convincing as it could be. Regards, -- Guilliam Xavier