Code: Select all
Property MyPropA
:Access Public
∇ z←get x
z←GetProperty x
∇
∇ set x;z
z←SetProperty x
∇
:EndProperty
:Property MyPropB
:Access Public
∇ z←get x
z←GetProperty x
∇
∇ set x;z
z←SetProperty x
∇
:EndProperty
:Property MyPropC
:Access Public
∇ z←get x
z←GetProperty x
∇
∇ set x;z
z←SetProperty x
∇
:EndProperty
The work required for getting and setting each property is identical, and thus extracted into two common sub functions, GetProperty and SetProperty.
However, despite this, the code is still massively repetitive, which makes me feel like writing it is a colossal waste of time. How can I get rid of it? I guess I have to write a function which generates the class script and then fixes it, is that the only way?