> On 29 Oct 2014, at 04:29, Jordi Boggiano <j.boggi...@seld.be> wrote: > > Yup that's definitely better than having the readonly flag in the {} block as > I had it. > > I'd however say that it should be possible to define a writable property with > only a getter and then the setter would implicitly be created. Since readonly > is the way to define writability why should I have to specify a setter (even > a default empty one) if none is needed? > > P.S: Don't want to open pandora's box, but we could also have writeonly for > completeness perhaps. I don't really see the use case at all though > (immutability sure, mutant bottomless pit objects not so much:).
I don’t think allowing write-only properties is a good idea if we need a new keyword for it. To be honest, for such a use case, using a setter method is probably better than assigning as if it were a normal property. While people would probably tolerate and understand read-only (from their perspective outside the class) properties, I think write-only properties will just lead to poor API design and confusion. -- Andrea Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php