4 ms·
Not all languages with getter/setter support will invoke them automatically like this. For example, it's not possible in Java or Objective-C to make an express
by mikeash 13y ago
Not all languages with getter/setter support will invoke them automatically like this.
For example, it's not possible in Java or Objective-C to make an expression of the form a == b, where a and b are plain variables, have any side effects.
- tyilo 13y agoIn Obj-C you can if you would allow `a.prop == b.prop`.
- mikeash 13y agoSure, but then it's obvious that you're doing something beyond an equality comparison.
- jacalata 13y agoDo you mean it is obvious to people who know objective C? I've never used the language, but its not obvious to me just from the other c-family languages I know.
- mikeash 13y agoYes, if you know Objective-C. If you don't know it, I wouldn't expect you to immediately grasp anything about the behavior implied by a snippet of it.