Stop comparing programming languages

  • Python is versatile
  • JavaScript is powerful
  • Ruby is elegant
  • C is essential
  • C++
  • Java is robust
  • @[email protected]
    link
    fedilink
    8311 months ago

    Mfw Rustaceans don’t exist :(

    Also, JavaScript…why are you the way you are? Does anyone have advice for learning it so it makes sense? I can’t even get tutorial projects to run properly…

    • @[email protected]
      link
      fedilink
      411 months ago

      Can it even make sense tho? To me JS is an example of a not too good thing that people started too eagerly so now they’re trying to make it make sense.

    • @[email protected]
      link
      fedilink
      311 months ago

      Start simple.

      And that probably requires not going with a tutorial. Because the JS ecosystem scorns at “simple”. Just make some HTML scaffold and use MDN to understand the DOM.

        • @[email protected]
          link
          fedilink
          English
          1211 months ago

          Last company I worked at used Typescript, but used any for everything… I have no idea why. I never got an actual answer.

          • @[email protected]
            link
            fedilink
            English
            1511 months ago

            Because they didn’t want to train their JS developers and didn’t want to cause friction for new projects. They get to say they’re using TS, with basically none of the real advantages. (Apart from general rational error checking.)

    • magic_lobster_party
      link
      fedilink
      1711 months ago

      I like Douglas Crockford’s talks about the “good parts” of JavaScript. They’re old and probably a bit outdated, but he explain quite well the history and why JavaScript is the way like it is.

      It clicked for me when I saw them the first time. Still hate JavaScript though.

      • wreel
        link
        fedilink
        English
        1011 months ago

        What Crockford did was enable a lot of devs to realize there was a viable development platform built into the most prolific and open network client in the world. For that he should be commended but it should have never been taken as “this is a viable general purpose language”.

        • magic_lobster_party
          link
          fedilink
          211 months ago

          He also showed that JavaScript has more resemblance to functional programming languages rather than object oriented ones. If you try to treat it as an object oriented language like Java (like the seem to imply), you will have a bad time.

          This has changed with TypeScript though.

    • @[email protected]
      link
      fedilink
      1811 months ago

      The mantra that got me through JavaScript was “almost nothing we do here is able to be synchronous”.

      Everything about the language makes more sense, with that context.

  • Rose
    link
    fedilink
    3011 months ago

    JavaScript is powerful

    Old joke (yes, you can tell):

    “JavaScript: You shoot yourself in the foot. If using Netscape, your arm falls off. If using Internet Explorer, your head explodes.”

    • @[email protected]
      link
      fedilink
      Cymraeg
      511 months ago

      C++ is inferior to Rust and should be used in no new projects unless it is absolutely necessary

      • @[email protected]
        link
        fedilink
        111 months ago

        I believe the trade-offs make Rust the best option to replace C++. Now, i’m not sure about Zig replacing C yet…

  • @[email protected]
    link
    fedilink
    2511 months ago

    C++ is all of those, provided you pick any 10% of it.

    You’re not supposed to cast every spell in the evil grimoire.

    • @[email protected]
      link
      fedilink
      11
      edit-2
      11 months ago

      Well, except “robust”, unless you have very strict code standards, review processes, and static analysis.

      (And arguably it’s never elegant, though that’s almost purely a matter of taste.)

        • @[email protected]
          link
          fedilink
          7
          edit-2
          11 months ago

          I see where you’re coming from, but no matter how many null pointer exceptions there are in Java code, you’re almost always protected from actually wrecking your system in an unrecoverable way; usually the program will just crash, and even provide a relatively helpful error message. The JVM is effectively a safety net, albeit an imperfect one. Whereas in C++, the closest thing you have to a safety net, i.e. something to guarantee that invalid memory usage crashes your program rather than corrupting its own or another process’s memory, is segfaults, which are merely a nicety provided by common hardware, not required by the language or provided by the compiler. Even then, with modern compiler implementations, undefined behavior can cause an effectively unlimited amount of “bad stuff” even on hardware that supports segfaults.

          Additionally, most languages with managed runtimes that existed when Java was introduced didn’t actually have a static type system. In particular, Perl was very popular, and its type system is…uh…well, let’s just say it gives JavaScript some serious competition.

          That said, despite this grain of truth in the statement, I think the perception that Java is comparatively robust is primarily due to Java’s intense marketing (particularly in its early years), which strongly pushed the idea that Java is an “enterprise” language, whatever that means.

  • luciole (he/him)
    link
    fedilink
    3611 months ago
    • C++ is fine
    • Python is fine
    • C# is fine
    • PHP is fine
    • JavaScript is fine
    • C is fine
    • Java is fine

    I could go on

      • @[email protected]
        link
        fedilink
        1511 months ago

        JavaScript is also not fine.

        C++ apparently has a lot of footguns if you use too many parts of it. C and orthodox C++ are fine.

        • polonius-rex
          link
          fedilink
          12
          edit-2
          11 months ago

          people say this but C is significantly more batshit than javascript

          oh you used scanf? one of the basic functions of our language? sorry that’s got a buffer overflow vulnerability so now your application is compromised

          • @[email protected]
            link
            fedilink
            9
            edit-2
            11 months ago

            Yeah, but as far as I understand that’s not a C vulnerability. It wasn’t added. C just exposes how the underlying CPU works.

            If you could avoid exposing dangerous memory quirks but still retain the same power… well, you’d have invented Rust. Rust is a better language than C, I agree with that.

            Edit: Yep, just double checked. Buffers live in physical memory and have to be finite, so if you advance outside of them you’ll go somewhere else. Scanf’s not special, this is just another inherent pointer issue.

            • xigoi
              link
              fedilink
              English
              111 months ago

              What’s the point of having a function in the standard library if the universal recommendation is to never use it?

              • @[email protected]
                link
                fedilink
                1
                edit-2
                11 months ago

                Is that the recommendation? This is the first time I’ve actually seen it discussed.

                I’m wondering at this point if a new, different stdlib would be better. Or just use Rust.

                • xigoi
                  link
                  fedilink
                  English
                  111 months ago

                  To be honest, my comment probably applies more to gets, but the point is the same.

            • polonius-rex
              link
              fedilink
              911 months ago

              exposing the machinations of the underlying CPU with no regard for safety is like, the definition of a footgun

              • @[email protected]
                link
                fedilink
                6
                edit-2
                11 months ago

                Okay, but how do you code on a CPU without directly interfacing the CPU at some point? Python and JavaScript both rely on things written in mid-level languages. There’s a difference between a bad tool and one that just has limitations inherent to the technology.

                Like, to echo the meme a bit, it’s not a totally straight comparison. They have different roles.

                • polonius-rex
                  link
                  fedilink
                  611 months ago

                  a footgun isn’t inherently bad, it just implies a significant amount of risk

                  yes, if you need the ability to code on a low level, maybe C is necessary, but the times where that is actually necessary is smol

                  also rust

  • @[email protected]
    link
    fedilink
    English
    1111 months ago

    What is C essential for anymore these days? Genuine question btw.

    I thought C++ was essential for microprocessor control, but that it depends and sometimes I gather people use C instead, but not always.

    Use the language that the company hires you to know:-).

      • @[email protected]
        link
        fedilink
        English
        111 months ago

        It isn’t just a language, but it is a language - as it eventually gets around to saying, but it starts off by saying that it isn’t, then later corrects itself to say that it is, etc. I feel like the focus of this ignores the historical context of what C was written to be for - at the time there was like Assembly, BASIC, Fortran (?), other long-dead languages like was it A and/or A* or whatever, there was a B language too! (developed by Bell Labs, if Google can be trusted these days), etc. - and C was developed to be better than those. So saying that like it lacks type conversions is very much missing the point - those were not invented yet. A lawn mower also lacks those, but it’s okay bc it doesn’t need them:-) I am probably nit-picking far too many points, I suppose to illustrate that the style of the article became a hindrance to me to read it b/c of those reasons. But thank you for sharing regardless.

        • @[email protected]
          link
          fedilink
          211 months ago

          I don’t really like the title either, but the article does demonstrate how unfortunate it is that we’re effectively locked in to using the ABI at some level of nearly every piece of software.

          That said, there definitely were languages with better type systems prior to the invention of C. Pascal is a frequently-cited example.

    • @[email protected]
      link
      fedilink
      1211 months ago

      Used to be embedded systems mostly. Microwaves and the like. Although with the advance of the smart home I don’t know I’d that’s still true.

      • @[email protected]
        link
        fedilink
        311 months ago

        The majority of microwaves, fridges, etc. Still don’t connect to WiFi. It’s mostly the high end ones which do.

    • @[email protected]
      link
      fedilink
      711 months ago

      The thing with C is that it’s almost always going to be the fastest high-ish level language and it has an extremely stable ABI. Self contained code written 30 years ago will likely compile with only minor (and sometimes no) tweaks today. You’re lucky to go 3 years on C++ without something fairly big breaking due to changes in the underlying language and ABI.

      • @[email protected]
        link
        fedilink
        English
        111 months ago

        That’s the kind of insight I was hoping for, thanks for sharing!

        C is also just a fun language to code in. You know, aside from pointers ofc:-). Though I have never done more than dabble around personally.

    • @[email protected]
      link
      fedilink
      1611 months ago

      Pretty much all of the command line coreutils programs I use daily are in C; cd, ls, pwd, touch, rm, etc. If I want to write some small utility I’ll usually reach for a scripting language first like bash python ruby etc, but if it needs to be small and fast I’ll use C instead.

      • @[email protected]
        link
        fedilink
        211 months ago

        Genuine question: if you’re writing a new CLI utility, why not Rust? This is arguably where Rust has most excelled, most famously with ripgrep.

      • @[email protected]
        link
        fedilink
        611 months ago

        Inertia is a mofo. I did embedded programming for industrial automation almost thirty years ago, building upon and expanding an existing nightmare of C code… and I bet there’s still some of mine running something out there to this day.

  • Xylight
    link
    fedilink
    English
    93
    edit-2
    11 months ago
    • Python is NameError: name 'term_to_describe_python' is not defined

    • JavaScript is [object Object]

    • Ruby is TypeError: Int can't be coerced into String

    • C is segmentation fault

    • C++

    • Java is

    Exception in thread "main" java.lang.NullPointerException: Cannot read the termToDescribeJava because is null at ThrowNullExcep.main(ThrowNullExcep.java:7)
    Exec.main(ThrowNullExcep.java:7) 
    
    • CSS j ust # sucks
    • <HTML />
    • Kotlin is type inference failed. The value of the type parameter K should be mentioned in input types
    • Go is unused variable
    • Rust is Compiling term v0.1.0 (/home/james/projects/Term)
    • @[email protected]
      link
      fedilink
      23
      edit-2
      11 months ago

      C++ is std::__cxx11::list<std::__shared_ptr<table, (__gnu_cxx::_Lock_policy)0>, std::allocator<std::__shared_ptr<table, (__gnu_cxx::_Lock_policy)0> > >::erase(std::_List_const_iterator<std::__shared_ptr<table, (__gnu_cxx::_Lock_policy)0> >) /usr/include/c++/12/bits/list.tcc:158

      • @[email protected]
        link
        fedilink
        611 months ago

        I once forgot to put curly braces around the thing I was adding into a hashmap. If I remember correctly it was like ~300 lines of error code, non of which said “Wrong shit inside the function call ma dude”.

    • xigoi
      link
      fedilink
      English
      1411 months ago

      Rust is downloading 1546 dependencies

      • @[email protected]
        link
        fedilink
        511 months ago

        I’ll happily download 63928 depends so long as it continues to work. And it does, unlike python projects that also download 2352 depends but in the process brick every other python program on your system

      • lastweakness
        link
        fedilink
        411 months ago

        Crates aren’t exactly runtime dependencies, so i think that’s fine as long as the 1500+ dependencies actually help prevent reinventing the wheel 1500+ times

  • @[email protected]
    link
    fedilink
    18
    edit-2
    11 months ago

    C++ is focused on getting a strong degree of root control over the hardware of lots of systems. Which is part of why it’s difficult.

    • @[email protected]
      link
      fedilink
      211 months ago

      I mean, if you’re talking about CVEs permitting attackers to get control of the hardware of lots of systems, then yes, I agree

    • xigoi
      link
      fedilink
      English
      311 months ago

      Only a part. A lot of the complexity is completely unnecessary.

    • @[email protected]
      link
      fedilink
      511 months ago

      Sorry, Undefined Behavior Everywhere was yelling way too loud to hear you clearly.

      Were you talking about strong controlling anything with C++?

  • tiredofsametab
    link
    fedilink
    1311 months ago
    • Rust has safety and efficiency close to C
    • Perl is processing most of your healthcare records
    • Ada is doing space stuff
    • Go is going places
  • @[email protected]
    link
    fedilink
    211 months ago

    Stop comparing tools

    • Hammer is heavy
    • Wrench is elegant
    • Saw is versatile
    • Screwdriver
    • Drill is exciting

    such pointless