Re: [RFC] [Discussion] Readonly class amendments

From: Date: Thu, 19 Jan 2023 11:10:37 +0000
Subject: Re: [RFC] [Discussion] Readonly class amendments
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-119349@lists.php.net to get a copy of this message
> Le 19 janv. 2023 à 10:12, Claude Pache <claude.pache@gmail.com> a écrit : > > > >> Le 19 janv. 2023 à 09:01, Máté Kocsis <kocsismate90@gmail.com> a écrit : >> >> Hi Everyone, >> >> As discussion apparently stalled, and since we managed to update the RFC >> with the recently brought up arguments, we would like to start the vote >> soon, possibly early next week, unless someone finds a new topic to discuss. >> >> Máté >> > > Hi, > > One shortcoming around readonly classes that I just figured out, is that it is not possible to > use them as anonymous class: > > ```php > $c = new readonly class { }; // parse error > ``` > > While it does not makes sense to have abstract and it is not > useful to have final in this position, on the other hand, it is > perfectly reasonable to have readonly here. (This is especially problematic in case we keep the > limitation that only readonly classes may extend readonly classes, because in that case, an > anonymous class could not extend a readonly class. However, this is an orthogonal concern.) > > —Claude As I think that this limitation is most probably a bug and not a deliberate decision (the RFC introducing readonly classes did not mention restrictions around anonymous classes), I have open a bug report: https://github.com/php/php-src/issues/10377 —Claude

« previous php.internals (#119349) next »