3 ms·
I'm not a C programmer, but in general, I think this is a great idea. I really wish that it could be added to a high-level language. However, I think it's funda
by tomp 12y ago
I'm not a C programmer, but in general, I think this is a great idea. I really wish that it could be added to a high-level language. However, I think it's fundamentally incompatible with some of the features of high-level languages, such as dynamic typing, first-class functions, partial application, parametric polymorphism, structural typing/extensible records...
- eru 12y agoWhy is dynamic typing a feature of high level languages? I know quite a few high level languages that are statically typed. And what does C have to do with C++?
- tomp 12y agoIt's not a necessary feature of high-level languages, but you won't find it in a low-level language. The same with all other features I've mentioned.
- vidarh 12y agoI'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...