News for hackers. Stuff that matters.
Re:The use of `class` for things that should be simple free ... by Huperniketes on Thursday May 28, 2020 @08:37AM (#23336531)
>There's one big difference in terms of convenience in many common implementations of classes and methods.

Which ones?

>However, it is much more rare to be able to store B in a variable and supply it "later". Often, you must store A.B:

How is it rare? Smalltalk doesn't require you to specify the receiver when storing a symbol. Neither does Objective-C (selector). Neither does Ruby. Nor Java.

Which commonly used languages require one to have the receiver tied to the method when memoized? C++ is the only one I'm aware of. So it might be rare to do it in C++, but not in OOP generally.

Re:The use of `class` for things that should be simple free ... by frutiger on Thursday May 28, 2020 @08:55AM (#23336654)
Even C++ lets you store the address of the member function and lets you invoke it with an instance later.
Re:The use of `class` for things that should be simple free ... by Huperniketes on Thursday May 28, 2020 @08:59PM (#23345119)
> Even C++ lets you store the address of the member function and lets you invoke it with an instance later.

Not for virtual member functions (not that I've been able to find). C++ is geared towards generating optimal executables. Since the type of the object is known at compile-time, the particular function used for that type is known, and the compiler will generate code that applies for it.

This is why C++ uses mangled names: to discriminate between identically named functions of different types and signatures.

Re:The use of `class` for things that should be simple free ... by projektfu on Thursday May 28, 2020 @03:29PM (#23341416)
Java before invokedynamic, I guess.