ooRexx has a handy syntax for exposing an object
internal variable as getter/setter accessor methods using
::method foo attribute
however, because of the way attributes are used, people
have a hard time thinking of them as "methods". They
are properties, not methods. So it would be nice if
the alternative syntax
::attribute foo were supported.
There are still some other problems here. For examply,
there's currently no means for defining read-only
properties. To do that, you need to drop down and
define an actual method for the property:
It would be nice to be able to code
::attribute foo readonly
Also, if setter logic requires some sort of validation,
then it become necessary to code both the setter and
getter methods. Additionally, the setter method gets
exposed to another bit of ugliness on the ::method
statement, the requirement to quote (and uppercase) the
method name to include the "="
for something like this, allowing the property to be
defined, along with the getter/setter methods in place.
For example ooRexx could do something like this.
use arg new
Either ::get or ::set can be optional. If not
specified, it will default to the automatically
Question: Should ::get ::set methods implicitly expose
the instance variable of the same name?