|
|
|
|
|
by dragonwriter
2343 days ago
|
|
> I like to be able to see at the calling site whether what I'm doing is calling a method or setting a property In Ruby, as is also true in many languages that have a syntactic distinction, setting a property is always ultimately calling a method, so the distinction is illusory. What you may want is a purity guarantee (well, that getters are pure and than setters have no effects except on the state specifically backing the property, but the latter gets complicated to apply to nontrivial properties), but most languages that let you distinguish whether properties or methods are exposed in an API don't provide a that kind of guarantee with properties, either, just more boilerplate code to implement them. And the whole point of properties over exposed data members is to abstract behavior so that implementation changes don't change APIs. |
|