new DIP5: Properties 2

Ary Borenszweig ary at esperanto.org.ar
Fri Jul 31 19:54:42 PDT 2009


Ary Borenszweig escribió:
> Andrei Alexandrescu escribió:
>> Steven Schveighoffer wrote:
>>> On Fri, 31 Jul 2009 16:53:12 -0400, Andrei Alexandrescu 
>>> <SeeWebsiteForEmail at erdani.org> 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.
>>
>> Of course we do. My point is that there's no need to add gratuitous 
>> mechanisms fostering conventions that go unchecked.
>>
>>> 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.
>>
>> Well you can trivialize all you want but the matters are different. 
>> It's one thing to have good names, good designs, trusted code etc. and 
>> a whole different thing to define a feature of which entire existence 
>> only serves only an unchecked convention.
> 
> Like... ddoc?

Partially kidding with this, partially not. Sometimes comments get old: 
after some refactors they don't get updated and they say the code does 
something when it actually doing something different. So maybe ddoc 
shouldn't have been introduced, maybe not even comments, because they 
could not match with what the code actually does.

But in the case of name vs. name() it's much simple: it's a really 
simple convention *that already exists in almost every other language*. 
Ok, people can choose not to follow it, just like naming functions with 
silly names, or not adopting naming conventions, but... why would they 
do that?



More information about the Digitalmars-d mailing list