On Fri, 31 Jul 2009 16:53:12 -0400, Andrei Alexandrescu <[email protected]> wrote:

Steven Schveighoffer wrote:
But in the case of properties only allowed without parens, functions require parens, you are defining a rule for the compiler. Think of the parentheses as an extension of the function name, like punctuation.

But you say no parens means query, parens means action. This is sheer unchecked convention.

But we already have sheer unchecked convention! I could make a function called sort that reverses an array. I don't get why it makes any difference to you that the meaning of parentheses and no parentheses is used by the author of the function. How is this bad or somehow worse than what we have now? If you don't trust the author's functions do what they are named for, don't use his functions and properties.

Since C was invented, we have had the convention that () means function, lack of () means property. You are acting like the last 37 years of programming languages never existed, and this is some "new radical" convention. D is of C lineage, so using long standing C conventions should not confuse people.

Maybe less confusion, definitely more burden.

The burden is on the author to come up with meaningful function names already. With real properties, at least that task is easier because you don't need to add extra context to ensure a word is treated as a verb or a noun (e.g. 'isEmpty' in order to make sure someone doesn't mistake 'empty' for an action). The compiler enforces the requirement of property syntax vs. function syntax, so no burden there.

-Steve

Reply via email to