
On 2016-06-01 10:03, Peter Dimov wrote:
Vladimir Batov wrote:
On 2016-06-01 05:03, Emil Dotchevski wrote:
It would have been useful for C++ to allow the declaration of non-friend "member" functions outside of the type definition. This would require no change in syntax.
Interesting... and liberating... and dangerous... :-) Aren't you suggesting to actually officially support encapsulation violation?
These are called "extension methods" and they don't violate encapsulation because they aren't "friends".
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0079r0.pdf
Peter, thank you for the link. Interesting... Sometimes (hmm, make it "always") feel like an old mammoth failing to keep up with the herd... and grumbling "I am happy with the way it is" :-) I am not sure if "to allow free function invocation syntax to invoke member functions and vice-versa" is exactly what Emil wanted. Quoting from the top -- the "declaration of non-friend "member" functions outside of the type definition". I read it as Emil wants it to be a "member" but declared "outside".