Walter Bright Wrote:

> > Properties. Your syntactic sugar:
> > 
> > int i = c.p; // int i = c.p()
> > p = i // c.p(i)
> > 
> > They can't do these things:
> > 
> > * No control over their use by class designer: ANY member function with one
> > or zero parameters may be called using 'property syntax'. This is not a
> > good thing.
> 
> Why not? Seriously, what is the semantic difference?
> 
Your view of the problem is too technical.
Functions used to denote arbitrary "actions", while properties are designed to 
simulate data rather than functions: fields with minor logic concerning 
accessing them, e.g. input validation. This got reflected in naming conventions 
directing to name functions with verbs and properties and fields with nouns. 
Properties being implemented by functions is a technical detail, which may 
change: the property logic can become declarative or come in a form of type 
checking and be tested by caller, or most probably it can be replaced by 
invariant altogether. All these alternative solutions have their certain 
limitations or advantages, but they effectively do the same thing as 
"functional" properties without changing their semantics. That's why properties 
are not functions.

Reply via email to