Hacker News new | ask | show | jobs
by debugnik 35 days ago
The C++ standard only ever uses the term "member function" for what other languages call "method", hence why it's pedantic to point it out.
2 comments

C++ literature, it was common all the way back before the standard came to be.

Example, Turbo C++ manual from 1990, 8 years before the standard.

It is no different from several languages having their own meaning for functor, e.g. it has three different meanings across C++, Haskell and Standard ML/OCaml.

Or what mixins mean between several OOP languages.

It's not just this, it's everywhere. It's as though C++ is an alternative not to other programming languages but to the entire discipline of Computer Science. The cases where this results in C++ having its own weird names for existing ideas are slightly annoying but the cases where the same terms mean something else quickly become infuriating.

The choice (in C++ and then Java and C#) to pretend that these "member functions" are somehow part of the data structure also more or less guarantees that some students will end up confused about what's actually in the physical representation. Of course the "git gud noob" mindset of C++ doesn't see that as a problem :/

To be fair, C++ isn't alone in this, lets go back into the 1970 and 1980's and compare OOP languages, including failing ones, and FP languages as well, to see how common many of those terms have prevailed to modern times, in what shape and form.

C++ has plenty of warts to complain about, however complaining for the sake of complaining usually doesn't win attention.

I checked how Simula calls its object methods, but it just uses the term procedure as for normal top level functions. At least it shows that the term method is not universal.

I think that C had members, so members that are functions just became that. But then again, members that are types are usually called nested types.