2012-03-31

getters and setters

3.3: adda/oop/getters and setters:
. they are always using implicit getters and setters,
so what is the syntax for redefining them?
. needs some way in the body
to differentiate var from function:
x:  'o.x; -- the default getter,
x`=(i): '(o.x`= i ) -- and setter .
. this assumes '(o) is the name of the instance;
in python this is called self .

No comments:

Post a Comment