3 ms·
> method calls have always just been syntactic sugar + namespacing for a free function, no? Not quite; they're more than that for languages that have dynamic d
by quietbritishjim 4y ago
> method calls have always just been syntactic sugar + namespacing for a free function, no?
Not quite; they're more than that for languages that have dynamic dispatch, like virtual methods in C++ or dyn impl in Rust. In that case, that argument affects which function is called. In the case of multiple inheritence (in C++), the implicit this parameter is also potentially subject to a pointer offset; if it's virtual multiple inheritence then that offset may even be computed at runtime.