Zig vs Rust. Which one is going to be future?

I think about pros and cons and what to choose for the second (modern) language in addition to C.

@[email protected]

  • OpenStars@discuss.online
    link
    fedilink
    English
    arrow-up
    11
    arrow-down
    2
    ·
    1 month ago

    Isn’t exactly this kind of thing what is mostly responsible for the demise of Perl?

    As I heard it told, the developers of Perl worked so long & hard on the next version after Perl 5, but then veered off to make a new language (Raku) and despite the reality being otherwise, people feared so much that Perl would die (i.e. that 6 would never materialize) that in the meantime “everyone” had switched to Python (despite it clearly being an inferior language - hehehehe:-P).

    So that would be a “con” I suppose, if fights over which language is better ends up diluting efforts to work on or with either.

      • OpenStars@discuss.online
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 month ago

        I have never quite understood this mode of thinking - I think it must be an imprecise statement. Yes, improper usage of Perl coding can be bad, but then so too can C/C++ with e.g. improper memory management? Yet, I don’t see people knocking down doors to learn the memory-safe Rust (and e.g. thereby be able to contribute to the Lemmy codebase), probably bc despite it being “better”, it also has a steep learning curve (and I don’t even know but I would assume: even for someone who already knows C?). Instead, people seem to want to learn Go, or Java - okay so that’s a rabbit hole b/c they are for entirely different purposes, but anyway I mean that each language has its own balance of trade-offs.

        So while on the one hand the worst-case scenario from a poor coder for Perl seems significantly worse than for Python, there are also benefits too: doesn’t Perl run up to 20x faster than Python, which is why many places e.g. booking.com have chosen to use it? In the hands of an experienced person, perl code is quite readable, while in contrast, I just absolutely HATE aspects of Python such as whitespace delimiting and the package management, plus I don’t know if I am imagining things (is is likely) but the code just seems to me to look obtuse, by comparison.

        Sometimes I’ll use awk, other times I’ll bump that up to a Perl one-liner or even full script, still other times demand Python or for number-crunching full C/C++, or Java for whatever reason, but… for things that you want fast & easy, I don’t really see Perl as “bad”? Granted, it shouldn’t be someone’s first language these days, compared to C or Python, but what is wrong with it, like awk, continuing to exist these days? Especially if it’s not in a production environment.

        I’m listening.

        • deegeese@sopuli.xyz
          link
          fedilink
          arrow-up
          6
          ·
          1 month ago

          Collaboration is a fact of life in software development.

          Therefore we must choose tools based not on a single developer’s preference, but by what their colleagues can use effectively.

          • Tools that are easy to write bugs with (C/C++)
          • Tools that are hard to learn (Perl)
          • Tools that are hard to hire for (Perl, Ruby)

          All of these should be fixed or shunned in favor of languages that are easier to hire, easier to learn, and easier to debug.

          • OpenStars@discuss.online
            link
            fedilink
            English
            arrow-up
            2
            ·
            edit-2
            1 month ago

            So *I* who am careful to write readable and safe code, have to use a non-preferred language preference b/c someone else cannot handle using it properly?!

            Sadly, that is the realization that I have come to as well. A chain is only as strong as its weakest link and all that… but no, really, that’s true, b/c modifications are likely to be made at some point (kinda biasing towards production there but even so, answers with perl one-liners on e.g. StackOverflow are ubiquitous, but someone would have to know the language to be able to modify them to suit their specific use-case, so also not at the same time).

            Fwiw I really did not think that Perl was hard to learn - though that was coming from the likes of assembly, various Basic styles, C/C++, and having already learned regular expressions via Unix e.g. grep and awk and sed. “Regular expressions” are quite a steep learning curve, though that’s not the same thing as Perl, and quite frankly Perl is the undisputed (iirc?) master of them all, so whether someone wanted to write Perl without those, or wanted to do try to do regular expressions without Perl, either way Perl seems good for having included regular expressions, not something to penalize the entire language for. Also, C/C++ (and Rust) has a bit of a known learning curve as well…:-) Though indeed it’s entirely fair to say that if someone were to pick just one language, then I would be hard pressed to find any justification for that being Perl. C/C++, Java, Python - all of these, depending on the situation, are fine choices, whereas Perl is absolutely niche.

            But even so, why would it follow that it would necessarily be a good thing if Perl, or let’s say awk, would fully “go away”? I kinda see Perl and awk as being in the same boat these days - both niche and powerful, yet both steadily becoming obsolete? Just b/c something else is “better” doesn’t mean that everything else must die. Except, as you mentioned, for reasons of collaboration and thus code-reuse. Even there though, putting all of our eggs into a single basket scares me: what if tomorrow Microsoft, or Google, decides to purchase the rights to Python and suddenly control that entire industry sector in one fell swoop?

            • deegeese@sopuli.xyz
              link
              fedilink
              arrow-up
              6
              ·
              1 month ago

              Personal projects vs everything else:

              Did you want to collaborate with other people? Use something other people like.

            • lad@programming.dev
              link
              fedilink
              English
              arrow-up
              4
              ·
              1 month ago

              So I who am careful to write readable and safe code

              I just want to point out that it’s hard to be sure your code is readable if you don’t work with a team. More than once I saw people write “readable” code that was not readable. My own code I deemed “readable” was in fact not, as time had shown when I returned to fix something. So, the cited part looks a bit arrogant 😅

              • OpenStars@discuss.online
                link
                fedilink
                English
                arrow-up
                2
                ·
                1 month ago

                Fair - and in fact doubly so bc even code that is readable in a language that someone else does not know (well) isn’t so “readable” by definition. i.e. “readable by someone who knows the language” != “readable by most developers”.

                Though having to rediscover how our code works is something shared by all languages. Perl does allow the worst there though.

    • mox@lemmy.sdf.org
      link
      fedilink
      arrow-up
      3
      ·
      1 month ago

      Isn’t exactly this kind of thing what is mostly responsible for the demise of Perl?

      Perl died because better tools became available.

      • OpenStars@discuss.online
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 month ago

        Python is not better in every way, it’s just more general-purpose, so has a wider range of applicability.

        Also more people use it, though by that logic we should all be forced to use Windows bc everyone else does as well?

        And Perl both still exists and is actively maintained, so it “lost prominence” rather than “died”.

        • mox@lemmy.sdf.org
          link
          fedilink
          arrow-up
          2
          ·
          edit-2
          1 month ago

          And Perl both still exists and is actively maintained, so it “lost prominence” rather than “died”.

          Okay, but you’re the one who called out “the demise of Perl”. Have you changed your mind? I was just responding to your question.

          For what it’s worth, I think you were right about that: Perl is dead, in the sense of no longer growing or even maintaining the reach it once had. Other languages are overwhelmingly chosen for new code, while Perl has mostly fallen into disuse outside of people who learned it in its heyday and haven’t moved on, and irrelevance outside of legacy systems. It might not be quite as much a dead language as Latin (which also still exists and sees some use) but it’s well on its way there.

          • OpenStars@discuss.online
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 month ago

            Haha, oh yes, definitely not only not actively growing anymore but fully actively declining instead - those internal politics mattered more than the actual language issues themselves, once again. Every time I see another Python update and how very many things they break, I think that thought again. Tbf newer updates breaking older code happens even with C++ too - backwards compatibility affects just everything - though the whole Python 2 vs. 3 definitely still rankles me.

            I guess I’m still having emotional trouble letting it go - but that is an absolutely perfect example of Latin, still spoken yet most definitely also considered “dead” at the same time. I guess this about sums it up:

            img