C++ UFCS update

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 13 08:54:27 PST 2016


On Saturday, 13 February 2016 at 10:27:59 UTC, Daniel N wrote:
> They were considering 6 alternatives and chose the worst...
> https://isocpp.org/files/papers/P0251R0.pdf

I'm not so sure this is the worst, given the C++ history. Think 
about this for a minute: "f(x,y) can invoke a member function, 
x.f(y), if there are no f(x,y)"

That means you can override member functions with local 
non-member functions, that it will encourage programmers to write 
`f(x, y)` and thus be more compatible with older compilers via 
freestanding shims, and just plain be more convincing for them to 
actually use non-friend, non-member functions which is the key 
encapsulation goal of UFCS.

It might not be an ideal decision, but I do think it is an OK one 
for C++.


More information about the Digitalmars-d mailing list