C++ UFCS update

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 16 00:08:46 PST 2016


On Tuesday, 16 February 2016 at 07:59:49 UTC, w0rp wrote:
> Personally, I find this proposal for C++ to be laughable. It's 
> like hitch hiking from New York to California, and only getting 
> as far as Texas and calling it good.
>
> The great thing about our UFCS is the left-to-right chaining of 
> algorithms.
>
> x.map!(...).filter!(...).reduce!(...)
>
> It beats the Hell out of...
>
> reduce!(...)(filter!(...)(map!(...)(x)))
>
> This proposal will encourage non member functions, which is 
> good, but will never reach the "aha" moment D had which gave us 
> UFCS chaining.

Ugh, that syntax is abusing the implied semantics of 
dot-notation; member-access. Better to have a pipeline operator.

Such syntax abuse is common in other languages too, so I don't 
get the "aha". It is more a case of "ugh, repeated mistake"...

Explicit extension methods is a much better alternative.




More information about the Digitalmars-d mailing list