Re: [RFC] Static class
| From: | Bilge | Date: | Mon, 24 Jun 2024 22:56:34 +0000 |
| Subject: | Re: [RFC] Static class | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-123794@lists.php.net to get a copy of this message | ||
On 24/06/2024 22:56, Alex Wells wrote:
Hey Bilge, I'm not usually a resident of these discussions, but it seems like this RFC is heading into a wrong direction. Let me explain: as it currently stands, static properties and methods live separately from instance properties and methods. That means a couple of limitations, namely: a static class member can never implement an interface's contract, and hence a static class could never be used as an instance; static class members have a separate reflection API; static class members cannot have expression initializers; there's no static constructor; and so on. AddingHi Alex, If you wish to implement data objects, what part of the current proposal precludes you from doing so? Cheers, Bilgestatic classeswould not solve any of the above issues, and they would still be barely useful. To counter these issues, Kotlin has a concept ofdata objects: <https://kotlinlang.org/docs/object-declarations.html#data-objects>.