• 8 Posts
  • 227 Comments
Joined 3 years ago
cake
Cake day: September 7th, 2023

help-circle

  • Ease of adoption, if I’m not mistaken (so I was told 20-ish years ago when I started learning C++). Think back to the early/mid '90s - there was a lot of existing C code out there back then, people really didn’t want to throw it away but had few options if they wanted to use something else. C compatibility offered a way for large companies to incrementally adopt C++. All you had to do was change your compiler and your existing C code would compile, and you could write new stuff in C++. In the mean time, other languages could only leverage that existing code by using message passing or FFI-like frameworks. For example, you would have to use JNI if you were writing Java I think - maybe there were other options, but it was a big pain to deal with at the time, especially since tooling was probably not as polished back then.

    Maybe it’s not as much of an issue today, but they have to maintain compatibility with earlier versions, so while it helped adoption a lot, it also is a big challenge for the language and its ability to move forward.



  • Sure, I’m familiar with the conditions under which Javascript was created, but those are all political issues, not technical ones.

    If you had to go back and recreate another C++, you would be forgiven for creating a bad language, because making a good, usable language without a garbage collector is really hard, and even moreso when it has to be compatible with C. If you had to recreate Javascript… I would think it would be expected that you don’t make a language with the same kinds of flaws JS has today. There were plenty of examples of languages Javascript could have been based off of when it was written (like Java).

    Case in point: it took decades for Rust to come around which was the first real challenge to C++. In the same period of time, we saw several GC languages appear (Java, C#, Go, PHP, Swift, Ruby, Python, all younger than C++), all competing against each other. Javascript would have been abandoned if it didn’t have a monopoly on web programming.



  • I’m not trying to goad you into an argument, though I could have admittedly phrased things better. I just can’t think of any reason why someone would want adopt Javascript as it is with all of its problems. A slice of pie is better than nothing at all. On the other hand, using Javascript when a much better alternative exists (namely Typescript) would be a significant liability in my opinion.

    In fact, pretty much everyone on our front-end team at work would agree too - they’re pretty much unanimous in saying that Javascript should basically never be used.


  • I also agree that Javascript is worse. C++ has two excuses for being bad:

    1. It has to be compatible with C, a language that’s multiple decades older than it, and
    2. It is not garbage collected.

    Javascript has neither of those two excuses. People only use it today because of the ubiquity of web programming. In fairness, it did kill off a few other technologies, like Flash and Java applets, but that was more Webkit and Chrome picking it as the winner than anything else.

    Maybe these arguments are a bit hand-wavy, but the way I see it, it’s like the C of the web programming era.


  • C++ and JS are objectively shit languages from the pool of used languages.

    This is a great point. There are a lot of even worse languages that are dead/dying and deserve to do so.

    But personally, I see a lot of people who continue to defend JS. And I have worked in C++ for about 5 years now and nobody I have worked with praises the language - most want to ditch it entirely and switch to Rust. I can think of maybe one person who claims that C++ is good enough, which is hardly any praise.

    This is all anecdotal stuff, so maybe we don’t see eye-to-eye though. I personally love C++, because it’s a really fun language to write, but I simultaneously think it’s an awful language, and the people who write/standardize it keep making the same kinds of bad mistakes over and over again.