UFCS and overloading

Szymon Gatner via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 7 09:15:55 PDT 2015


On Tuesday, 7 April 2015 at 14:46:52 UTC, cym13 wrote:
> EDIT: mis-formatted previous snippet
>
> import std.algorithm, std.stdio, std.range, std.conv;
> void main()
> {
>     stdin
>         .byLine
>         .filter!(s => !s.empty && s.front != '#’) // Filter 
> with this lambda function
>         .map!(s => s.to!double) // Map the strings to doubles
>         .array // Sorting needs random access
>         .sort!((a, b) => a < b) // Another lambda
>         .take(10) // Applyable to any range
>         .writeln;
> }

Yup, I get that, still does not explain why UFCS can't extend 
overload set. Especially if there would be no conflict wrt to 
overload of method vs free function.


More information about the Digitalmars-d-learn mailing list