another round of call-chaining mystery?

James Dennett jdennett at acm.org
Thu Mar 29 23:10:21 PDT 2007


kris wrote:
> James Dennett wrote:
>> kris wrote:
>>
>>> James Dennett wrote:
>>>
>>>> kris wrote:
>>>
>>> [snip]
>>>
>>>>> There never was any argument of which you claim. I simply noted that
>>>>> eval-order had been clarified before, using your usage of "eval-order"
>>>>> from within the same post. If you revisit, you'll see that was
>>>>> actually
>>>>> referring to call-chaining instead, so there's perhaps a misuse of
>>>>> terms:
>>>>>
>>>>>  Cout.opCall("Hello, ").opCall(Cin.get);
>>>>>
>>>>> As you can see, there is only one parameter passed to each call, and
>>>>> therefore the order of /parameter/ eval is "not at stake here" (as I
>>>>> noted to Frits). 
>>>>
>>>>
>>>> There are two arguments to the second opCall.  One is
>>>> the result of Cout.opCall("Hello, ") and the other is
>>>> the result of Cin.get, and they can be evaluated in
>>>> either order unless some rule prohibits it.
>>>
>>> I think you'll find that call-chaining does not operate in that manner,
>>> James? If you look a bit closer, you'll see that the lhs has to be
>>> evaluated first, simply to get something to deref the rhs. Further,
>>> there is only one argument permitted to the opCall() itself
>>>
>>> For a fuller description, I suggest you bring it up with Walter instead?
>>
>>
>> Walter's post in this thread (<eui80b$19hl$1 at digitalmars.com>)
>> seems to confirm my viewpoint as quoted above.  If you still
>> don't think so after reading his message, I'd be interested
>> if you can explain where Walter's explanation differs from
>> mine.
>>
>> Regards,
>>
>> James.
> 
> Simply because that's what Walter led us to believe a long time ago,
> James, and it is how the compiler is implemented. Don't know what else
> to tell you.

I doubt that Walter lead you to believe that the order of
evaluation was defined for the particular example code
under discussion here.  ("Call chaining" is not the issue
at hand; order of evaluation of function arguments is the
relevant issue.)

Did you read the message of Walter's to which I referred?

Walter wrote, today:

> The nested opCall will get called before the outer opCall,
> but otherwise the order is undefined (and will change
> depending on the function calling convention, whether it
> is a virtual call or not, etc.).

This is very concrete and very specific, and supports what
I wrote above.  Are you suggesting that you disagree with
this?  (If so, with what do you disagree: that Walter wrote
this, that it supports my viewpoint, or something else?)

-- James



More information about the Digitalmars-d mailing list