Function calls

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Jan 28 14:25:59 PST 2010


Bill Baxter wrote:
> On Thu, Jan 28, 2010 at 2:07 PM, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>> Bill Baxter wrote:
>>> On Thu, Jan 28, 2010 at 1:26 PM, Andrei Alexandrescu
>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>> Steven Schveighoffer wrote:
>>>>> On Thu, 28 Jan 2010 15:59:30 -0500, Andrei Alexandrescu
>>>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>>>> foreach (line; stdin.byLine()) { ... }
>>>>>>
>>>>>> vs.
>>>>>>
>>>>>> foreach (line; stdin.byLine) { ... }
>>>>>>
>>>>>> How do I choose?
>>>>> byLine is a property.  It is fetching a range on stdin.
>>>>>
>>>>> -Steve
>>>> Damn. I was sure the answer will be different.
>>> Maybe "property" is a misleading word.  Clearly there are more things
>>> to which that applies than just what the traditional definition of the
>>> word would imply.  I would not in English call my nose a "property" of
>>> me, but if I were a D object and had a .nose accessor, I would
>>> certainly think that accessor would qualify as a D property.
>>>
>>> How's this: anything that you can "get" without specifying additional
>>> information (and which doesn't change the outwardly visible state the
>>> object when you do so) is a property.   The C# syntax with the special
>>> use of "get" and "set" perhaps does a better job of conveying this.
>> This raises the hair on my back. It's back to programming-by-convention.
> 
> Wait, you started off by saying "how do I decide?" and we give you a
> rule you can follow to decide and now you say you don't like it
> because it's programming-by-convention?   I guess I don't really
> understand what your argument is.

It's not a rule. It's several contradictory ones.

Andrei




More information about the Digitalmars-d mailing list