Re: [RFC] Readonly Properties

From: Date: Fri, 24 Oct 2014 23:34:03 +0000
Subject: Re: [RFC] Readonly Properties
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-78318@lists.php.net to get a copy of this message
Hi! > Here’s another RFC: > https://wiki.php.net/rfc/readonly_properties > > It proposes, with a working implementation, a modifier for properties that makes them readable > and writeable from different scopes. For me, this seems both too big and too small. Too small, because if you really it assigns a keyword to special use case of a generic feature, and thus I think does not lead us on the right path - we could not assign keywords to every behavior of properties, so either we forever reject the idea of having any generic solution there, or we'd eventually have two solutions, working in two different ways. Too big because this particular case is already very easy to implement by just making the property protected and having a public getter. It doesn't add any capability that we already don't have, and having a keyword just to save typing () seems unnecessary to me (performance is really irrelevant here, if your performance is bound by speed of accessors, you should be writing that code in C). Also, the name "readonly" appears misleading as it's not really read only - it's only read only for some classes, but writeable for others. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/

« previous php.internals (#78318) next »