On Fri, Oct 24, 2014 at 10:41:38AM +0200, Patrick Schaaf wrote: > Am 24.10.2014 01:36 schrieb "Andrea Faulds" <a...@ajf.me>: > > > > Here’s another RFC: https://wiki.php.net/rfc/readonly_properties > > +1 for the general feature, I'd love to have that available. > > I have an idea regarding the additional keyword, with a small implication > (improvement) to the functionality provided, but at the cost of being > slightly quirky :) The idea is: > > public $foo as private; > public $bar as protected; > protected $baz as private; > > where the "as X" gives the writability scope. This introduces no new > keywords, and is currently not valid syntax, as far as I can see.
More as musing than anything else - might provide some insight via an analogy. Properties and methods have a scope that is: private, protected or public. This reminds me of the Unix: owner, group & other file permissions. Unix allows: read, write & execute. This RFC is trying to control how a property could be used with a readonly restriction. Are there times when one would want to be able to set a property value - but not read it ? Thinking about execute - would there be any mileage in an execute permission - could be useful for a property that had been assigned an anonymous function. Finally we could bring it all together and sidestep the scoping keywords using 'var' instead. Thus: var $callback as 0751; Would define a property that contains an anonymous function that could be called by anyone, inspected by the class & related class, but only set by the class itself! -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php #include <std_disclaimer.h> -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php