2 ms·
I'm uncertain what languages other than C++ you think would benefit much from this. The reason C++ would benefit from this in the first place is because of a c
by vidarh 12y ago
I'm uncertain what languages other than C++ you think would benefit much from this.
The reason C++ would benefit from this in the first place is because of a combination of its lack of higher level features (e.g. enabling extension/mixing in functionality in less painful ways) and its "C legacy" in the form of vast amounts of non-OO code.
E.g. consider a language like Ruby, which has most of what you list as features of "high-level languages". For Ruby this would be very weird to begin with, because Ruby does not have non-member functions - everything calleable in Ruby is a method; what looks like free-standing functions in Ruby are functions on an object whose eigenclass is the implicit outermost scope.
What we'd do instead in Ruby is to put "function like" methods in a module that we can include in whatever objects we want.
But you can in fact easily achieve what this proposal does in Ruby.
- tomp 12y agoMany languages that are not primarily object-oriented. E.g. it was proposed in Rust [1]. It could also be added to many other functional languages, as often the "object-oriented" function call syntax looks more natural (when the first parameter is "special", the object of the call) than the "mathematical" function call syntax (appropriate for when parameters are equivalent, e.g. `max()` or `dot_product()`). [1] https://mail.mozilla.org/pipermail/rust-dev/2013-October/006034.html https://mail.mozilla.org/pipermail/rust-dev/2013-October/006...