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

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Nov 1 20:43:11 UTC 2017


On Wed, Nov 01, 2017 at 03:38:32AM +0000, codephantom via Digitalmars-d wrote:
> On Tuesday, 31 October 2017 at 15:45:42 UTC, H. S. Teoh wrote:
> > The one case where the difference matters is when you're trying to
> > debug something.  In that case, I'd say the onus is really upon the
> > debugger to tell you what kind of function it was.
> 
> Yes, this is my main concern I guess, as I use pretty plain editors
> that tell me nothing. I rely on the code to tell me what I need to
> know.
[...]
> I guess with a more enhanced editor I could just mouse over UFCS
> syntax, and it could identify a free function from a member function.
> That would be nice, since there's no other way to know without
> exploring code elsewhere...

I'm a vim user, and frankly, I don't find the need for "enhanced"
editors at all. (I don't even use syntax highlighting, but that's
another story. :P)

If there's a function call that could be either a member function or a
UFCS free function, all I need is to have the debugger print a
stacktrace and that ought to clear things up.  It will even resolve
other issues like telling me exactly which overload is being called, if
there are complicated overload sets, and point me to the exact file/line
of the code.  At that point, the difference between UFCS free function
or member function is basically irrelevant.


> I guess the days of use a plain text editor...are slowly coming to and
> end ;-(
[...]

Nope.  Plain text editors still rule.  GUIs are for wimps. :-P


T

-- 
The best way to destroy a cause is to defend it poorly.


More information about the Digitalmars-d mailing list