Re: RFC: Locked Classes

From: Date: Mon, 11 Mar 2019 14:18:46 +0000
Subject: Re: RFC: Locked Classes
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-104655@lists.php.net to get a copy of this message
On Mon, 11 Mar 2019 at 12:35, Nikita Popov <nikita.ppv@gmail.com> wrote: > > Removing the ability to use dynamic properties (even excluding stdClass) > is probably not feasible on a short timetime. However, I think that having > a directory-scoped declare would also be useful for that, because it allows > a more gradual migration. You can start with having strict_properties > default to false and have interested parties opt-in. Then you can flip the > default to true, while still giving people who rely heavily on it the > ability to opt-out. Removal would be the final stage where the ability to > opt-out goes away. > > I think that's actually the best argument I've seen so far. The current proposal is basically very conservative: a simple, self-contained change, that even a noob like me was able to implement. The downside of that is that it doesn't have a long-term vision: there's no clear path to making all classes "locked" by default. I agree that the combination of package- or directory-scoped declares, and a switch that can be both opt-in and opt-out, gives a better future direction. I just hope we get those things, rather than just having neither - as happened with "static class", which was rejected partly because "we'll have function autoloading real soon". Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#104655) next »