-
-
Notifications
You must be signed in to change notification settings - Fork 4
property
A property is a field with get and set methods.
Because functions in angle can be invoked without parenthesis, properties, fields and functions are opaque to the developer, allowing for refactoring and ABI changes without breaking compatibility. Getter functions do not need a special keyword:
person{ age:{date - 1996} } // is the same as
person{ age:get{date - 1996} }
https://blog.willbanders.dev/articles/a-case-for-properties.html
property age with implicit getter (value) and setter:
age:set{value=it}
OR
age:set{it=value}
?
The preferred style is a free declaration:
To set the age of a person: value be it
OR
To set the age of a person: its value be value
?
the keyword value
represents the internal value of the property
the keyword it
represents the argument to the setter of the property
property age with setter:
age{it}set{value=it}
Typed property age with getter and setter:
year age{value}set{value=it}
The name of key-value pairs in Angle data objects is 'field'.
person{name:"Joe" number():random age:get{date - 1996}}
-
field
name
-
member function/method
number
-
property (getter function)
age
They can be accessed as usual
- with dot syntax
person.name
- with index syntax
person["name"]
- with index syntax
person[name:]
- with possessive syntax
person's name
- with possessive syntax
name of person
Question how shall setters be represented? in meta field? of course person{ birthday=2000-10-10 age:{date - birthday}set{birthday=it} }