Closed fulrich closed 5 years ago
writable
instead of read_only
?protected
rather than not defining it at all?(I don't have strong opinions on either.)
I liked the change to writable
and have updated this PR to include it.
I decided to keep the setters as not defined instead of protected
simply because the naming doesn't convey this as strongly to me. writable
states whether it is able to be written to or not. It doesn't convey that is can be written to but only by the class itself or inherited classes.
By default
property
creates both an accessor and a reader for the property. Currently if you do not want a public accessor you have to do something similar to the following:This proposed change allows the ability to make a property read only:
When using the
read_only
flag astrue
an accessor will not be created for that property. If noread_only
flag is provided the current default behaviour of creating an accessor will continue.