Function calls

Pelle Månsson pelle.mansson at gmail.com
Thu Jan 28 14:54:33 PST 2010


On 01/28/2010 11:23 PM, Michiel Helvensteijn wrote:
> Andrei Alexandrescu wrote:
>
>> I agree. So where's the consensus? Things seemed so clear when people
>> were beaten with @property over their head.
>
> If I read the TLP correctly, @property seems not to be working correctly.
>
> @property (or any other notation marking property getters/setters) should be
> enforced. Functions that have it must only be invoked using property
> syntax. Functions that don't have it must be called with parentheses.
> That's the whole point. To give the designer of the class control over how
> it is used.
>
> The problem is people blurring the line between what's supposed to be a
> function and what's supposed to be a property, by abusing property syntax
> to invoke actions without parentheses.
>
> In reality, I believe there's not only a clear line between the two
> intentions, there's a demilitarized zone. You just need to enforce it. You
> can't have your cake and eat it too.
>

I don't understand what any of this would improve. Is the byLine example 
less readable without the ()? Is it more bug prone?

The only thing achieved as I can see is that every class designer makes 
up his own rules about which functions are property and which are not. 
If this is somehow enforced, it will become a guessing game about how to 
call no-argument functions. For what?



More information about the Digitalmars-d mailing list