Re: Trivial (but not bikeshed please) question of style…

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Tue Oct 28 07:04:35 PDT 2014


On 10/28/14 9:41 AM, "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= 
<ola.fosheim.grostad+dlang at gmail.com>" wrote:
> On Tuesday, 28 October 2014 at 08:15:58 UTC, Russel Winder via
> Digitalmars-d wrote:
>>     parent.send(result)
>>
>> or:
>>
>>     send(parent, result)
>>
>> as being idiomatic D code?
>
> I cannot speak for idioms, but this is a good example of how UFCS fails
> to capture the semantics of dot notation.
>
> "X.action(Y)" will in most OO languages mean do "action" to object "X",
> but "parent.send(results)" means the opposite?! That's not good.
>
> "send(parent,result)" is therefore better.

I think it means, send result to parent. Isn't this what you said?

On the larger question, I think whatever seems most natural should be 
used. UFCS can make things read very confusing. But I don't think this 
is an example of that.

-Steve


More information about the Digitalmars-d mailing list