On 10/28/2014 06:41 AM, "Ola Fosheim Grøstad" <ola.fosheim.grostad+dl...@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.

Agreed.

Going off-topic a little, I don't like putting .writeln at the end for a similar reason: It makes sense only when it is writeln (not writefln) and there is only one item to write:

    42.writeln("hello");             // Not good
    "The value: %s".writefln(42);    // Not good
    42.writeln;                      // Acceptable but not for Ali

Although acceptable, I don't use the last form because I don't like the other forms.

Ali

Reply via email to