Function calls

Bill Baxter wbaxter at gmail.com
Thu Jan 28 14:54:41 PST 2010


On Thu, Jan 28, 2010 at 2:48 PM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> Bill Baxter wrote:
>>
>> On Thu, Jan 28, 2010 at 2:25 PM, Andrei Alexandrescu
>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>
>>> 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.
>>
>> Please point out the contradictions.  I'm not seeing them.
>
> Some said it should be stdin.byLine(), some others said it should be
> stdin.byLine. They invoked contradictory rules that led to contradictory
> conclusions.

Ok, I thought you were saying my rule was somehow self-contradictory.
I understand what you mean now.  Just that the rule to apply is not
obvious.  But I think that applies to many things in computer
programming.  Whether to use pointers or references.  Whether to use
classes or struct.   Whether to make something private or protected,
or virtual or non-virtual.  Some cases are obvious, others are not.

--bb



More information about the Digitalmars-d mailing list