And under the hood the difference is also minimal. A member function is compiled to a free function in the object file. It's only the mangled name that makes the difference.On 10/30/17 9:44 PM, codephantom wrote: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..gobj.\func(). (or something like that ..where \ means its a free function)I once thought as you do (though not as the syntax you propose). I now embrace UFCS fully, it's awesome.
Re: Required Reading: "How Non-Member Functions Improve Encapsulation"
Patrick Schluter via Digitalmars-d Mon, 30 Oct 2017 23:25:46 -0700
On Tuesday, 31 October 2017 at 01:47:39 UTC, Steven Schveighoffer
wrote:
- Re: Required Reading: "How Non... H. S. Teoh via Digitalmars-d
- Re: Required Reading: "How Non... Steven Schveighoffer via Digitalmars-d
- Re: Required Reading: "Ho... Jonathan M Davis via Digitalmars-d
- Re: Required Reading: &quo... H. S. Teoh via Digitalmars-d
- Re: Required Reading: &quo... codephantom via Digitalmars-d
- Re: Required Reading: ... Steven Schveighoffer via Digitalmars-d
- Re: Required Readi... codephantom via Digitalmars-d
- Re: Required ... Steven Schveighoffer via Digitalmars-d
- Re: Requi... codephantom via Digitalmars-d
- Re: Requi... Jonathan M Davis via Digitalmars-d
- Re: Required Readi... Patrick Schluter via Digitalmars-d
- Re: Required Reading: ... Dave Jones via Digitalmars-d
- Re: Required Reading: ... H. S. Teoh via Digitalmars-d
- Re: Required Reading: ... codephantom via Digitalmars-d
- Re: Required Readi... H. S. Teoh via Digitalmars-d
- Re: Required Reading: &quo... Dukc via Digitalmars-d
- Re: Required Reading: ... H. S. Teoh via Digitalmars-d
- Re: Required Reading: &quo... jmh530 via Digitalmars-d
