On 11/2/21 6:49 PM, zjh wrote:
On Tuesday, 2 November 2021 at 23:02:42 UTC, Ali Çehreli wrote:
On 11/2/21 3:57 PM, Ali Çehreli wrote:

  const x = readln.strip;

this is very interesting .`readln` then `strip;`,Very natural.



Yes, UFCS (universal function call syntax) makes code natural, concise, and readable (but things can get out of hand :) ).

Here is an example copied from the home page of dlang.org:

import std.stdio, std.array, std.algorithm;

void main()
{
    stdin
        .byLineCopy
        .array
        .sort!((a, b) => a > b) // descending order
        .each!writeln;
}

Ali

Reply via email to