Required Reading: "How Non-Member Functions Improve Encapsulation"

codephantom me at noyb.com
Tue Oct 31 01:44:58 UTC 2017


On Monday, 30 October 2017 at 23:03:12 UTC, H. S. Teoh wrote:
>
> But in D, UFCS allows obj.func() to work for both member 
> functions and free functions, so if the client code uses the 
> obj.func() syntax, it won't have to care about the difference.
>

I don't like it.

When I see obj.func(), to me, func() is a member function. Why 
should I spend any time trying to work out whether it's a member 
function or a free function? It doesn't make sense to me.

If it's really a free function, I'd like that to be more 
explicit..

e..g

obj.\func().   (or something like that ..where \ means its a free 
function)


More information about the Digitalmars-d mailing list