very interesting discussion for me https://github.com/modula3/cm3/issues/12
What do you think about implementing properties in Objects?
OBJECT
...
PROPERTIES
intValue : INTEGER READ GetIntValue() WRITE SetIntValue();
I wouldn’t mind adding some things like this as long as they are very obviously simple syntactic sugar for existing operations. This looks like something like that…
shouldn’t it be, though
PROPERTIES
intValue : INTEGER
READ := GetIntValue() : INTEGER
WRITE := SetIntValue(to : INTEGER);
to more closely match the syntax for methods.
Also it won’t work on RECORDs, which is a bit odd.
I suppose it follows the existing property (which I would not want to break) that you can almost always change a T = REF RECORD … to T = OBJECT … without breaking anything, but not the other way around.
#modula #programming #programming_languages #modula-3 #cm3 #modula3 #compiler