by arcticbull · 6y ago · 0 comments
I think Bjarne isn't getting the issue with C++. Yes they're Turing-complete, yes they can both solve the same set of problems.
The issue is that C++ can do everything that every other language can do, which means it's not a language, it's a universe of features. You make the language by picking which features, patterns, philosophies, architectures you want. It's like if a language dictionary included English, simplified Chinese and Korean.
The problem IMO is there's no such thing as C++. Each company, each team, each person has their own. Many of these C++'s are incompatible with each other.
Worse, many of the new language features can't be properly implemented because they would break someone else's C++.
The problem is it tries to be everything to everyone, and that makes it (and futures standardization efforts) full-on Quixotic efforts. I mean, by all means, have at those windmills tho.
Bjarne points out how much he hates templates, and has some great new ideas for generic programming. Lovely, but he's never gonna get rid of templates, so now we have 2 problems.
There's another "truth" of PLs: Curry-Howard. So a language with a richer type system can express more propositions than a lesser one. Just because two languages are Turing equivalent doesn't mean they are Curry-Howard-equivalent.
So the things some languages can do that others can't happen at compile time.
And tbh, you'd probably be better served by a language that isn't Turing complete but allows you to express rich types than a Turing complete language with a bad type system. Very little of people's code needs Turing completeness.
This is a very myopic view, and misses the point entirely. The entire notion of a "Turing machine" is that any Turing-complete machine can compute any result that another Turing-complete machine can compute. No mention is made of how the results are computed or how the programmer approaches the problem on each machine.
Any Turing Complete language can be used to do the same work as any other Turing complete language or mechanism.
The expressiveness of any particular language does not factor into the equation at all, and does not matter at all when speaking of what is computable and what is not.
You are talking about language features, which is an entirely different topic. All Turing-complete languages are equivalent in terms of their abilities; that is to say that they can all compute the entire set of computable results.
The Wikipedia page on Total Functional Programming [1] has a nice (even if contrived) example of this with Quicksort. I feel like my undergrad complexity class did me a disservice by emphasizing Turing Completeness so much without discussing any other aspects of abstract computation, like lambda calculus, type systems, etc..
[1]: https://en.wikipedia.org/wiki/Total_functional_programming
> I think Bjarne isn't getting the issue with C++.
In my opinion, put succinctly, the issue with C++ is that it can do things that Rust can't. And, as it turns out, most of the things that it can do over Rust aren't important for solving problems (one of those things is explicit memory management).
> Rust people [...] accuse [...] stolen
There is something that many developers struggle with, and it seems to be cropping up here. You are not your work, folks. Go back and honestly look at your very old code, it's probably not good, it's probably not good at all. There's no reason to be ashamed of that, because your work is not your identity.
If your work becomes your identity, you lose the ability to critique your own work objectively (biologically/psychologically), which really impedes your ability to improve your work.
Because that was his point, the whole argument about developers identifying with their work seems to sidetrack the original discussion.
> the whole argument about developers identifying
Taking inspiration from C++ is inseparable from developing a language today. Arguing about who "stole" ideas is sidetracking the overall discussion, in the first place. The development of C++ is being hampered by the perception of a threat/enemy who "steals" ideas - which is a very human and normal way to act. If the discussion is "them/Rust" vs. "us/C++", then the reasoning behind that counterproductive mindset is worth talking about.
> “But besides adding object orientation to C, he also remembered his earliest design goals for C++. “I wanted very great freedom of expression, very great generality. [...]”
I can only speak from my own experience here, so it's anecdotal, but the main reason I love using C++ is precisely this "great freedom of expression", which is most likely, but at least in part, a direct consequence of the fact that it "tries to be everything to everyone". When writing C++, my mind often wanders and comes up with code and designs that would either be actively discouraged in the majority of other (opinionated) programming languages, or straight up impossible to implement. It's a great and highly valuable (possibly creative) experience that I haven't, to this extent, experienced in any of the other (numerous) languages I've been using. I also feel it makes me a better software engineer as a whole, even when I'm not working with C++ (which is actually most of the time). Beyond that, I also feel it's one of the reasons why C++ is so successful.
Obviously it also leads to the fragmentation you described, and it's perfectly valid to criticize, but I wish people would, more often, at least acknowledge that this kind of programming language is still valuable in certain ways and situations.
Yes, if you are mainly focused on getting a job done with minimum friction (and maybe maximum speed), there is a high chance that there is a language better suited for the task than C++ in today's age. That does not make C++ obsolete, quite the opposite in my opinion. I believe the fact that C++ isn't as opinionated or streamlined as other languages shouldn't be considered an "issue" or a "problem", but a feature.
Generic wise phrase: Perfection is not reached by adding more and more things, but by taking things away, until only the true core ideas remain, on top of which one builds the rest.
This is something C++ is very far away from attaining. What one wants for maintainabIlity, simplicity and understandability is the core concepts, not 120 keywords and different meanings of keywords depending on where they appear.
I agree.
I'm not sure why C++ needs to attain perfection of this specific kind - or any kind, for that matter. You could also argue that the great freedom and flexiblity were preconditions for (or at least greatly aided in) the creation of languages like Rust. Through them, people learned what to be aware of; and were thus capable of "distilling" this knowledge into such languages.
My point is: there is nothing inherently wrong with a language choosing to be liberal/maximum generality, allowing for a playground on which new ideas and learnings can happen. I consider C++ to be of that kind, it has served this purpose for a long time in my opinion.
Don't get me wrong though, I'm perfectly aware of all the issues that come with it, and I'd not advocate C++ as the language of choice for the majority of software nowadays. I reject the idea though that C++ should now be considered obsolete, redundant, or anything that goes into that direction just because some people now believe to have found some kind of (final) "perfection" in new languages.
But yes, you are completely right: teams developing ultra complex languages (e.g. C++, Scala, Ada) usually fail to understand that the fact their language can do everything all the other languages can do is exactly the problem.
The value of these other languages is precisely choosing not to have certain features.
I don't think he's saying he hates templates in general:
> “I’m not a great fan of template meta-programming"
He's not a great fan of template meta-programming which is a specific use (or abuse depending on your point of view) of templates. Though it is a fairly popular use of templates now.
If I interpret this sentence with English understatement, then indeed, he hates templates.
(I interpreted his British-rooted understatement in the same way as the parent comment.)
And yet, I understand where the baggage comes from. My favorite language when I was young, Python, went through a decade of stagnation because programmers couldn't be hassled to write print('hello') instead of print 'hello'. It's frustrating, but almost all languages gather baggage over time.
Features can’t really be removed from C++ because a major advantage of the language is compatibility with existing code. However, within that constraint, C++ is driving toward a simpler, cleaner, safer dialect. It’s a hard problem.
None of statement are true...
C++ cannot do everything. C++ can do most every other "system programming languages" do, but that's by design that they are all system programming languages.
Even if C++ can do everything as other languages, that does not make it beyond a language. C++'s system is coherent. It is complicated, but no where it contradicts itself in any major fashion.
That generally does not happen with other languages.
> Worse, many of the new language features can't be properly implemented because they would break someone else's C++.
Could you give an example?