• whaleross@lemmy.world
    link
    fedilink
    arrow-up
    50
    ·
    3 days ago

    People that try to do mathematical operations with strings blaming the programming language that had a stated design goal to do its best and try to keep running scripts that make no sense because they realized it would be used by people that have no idea what they are doing. Clearly they were right.

    • grue@lemmy.world
      link
      fedilink
      arrow-up
      45
      ·
      3 days ago

      the programming language that had a stated design goal to do its best and try to keep running scripts that make no sense…

      …itself makes no sense. It is wrong and bad that Javascript was ever designed that way in the first place.

      • whaleross@lemmy.world
        link
        fedilink
        arrow-up
        24
        ·
        3 days ago

        It was never intended to run full applications but only the small business scripts and hobbyist homepage stuff that were the thing in the 90s, across inconsistent browsers that were a jungle of hit and miss behaviour where it was preferred that menus keep working even if the mouse effect was not. Anything of scale was expected to be done in Java. Dynamic web pages did not exist and as anything not static was generated server side into a static html file to be rendered on the client.

        Anyway, back then it wasn’t considered the job of the programming language to hold the hand of the aspiring developer as it is common today. It’s not a bad thing that IDE and even compilers and preprocessors try to help you write better code today, but then it simply didn’t exist.

        JavaScript is from a different time and because it has the hard requirement or backwards compatibility there is no changing it and has not been for thirty years except to add stuff to it.

        I think it’s just silly to ask the past to keep up with the present. Bad code is not the fault of the language regardless, even though junior devs and even seasoned ones like to think so to protect their ego. I think it is better to accept it, learn from it and roll with it because every single platform and language has their weird quirks anyway.

        Signed, old dude that learned programming in 8 bit BASIC and 6502 machine code without an assembler, where code bad enough would freeze your machine that required a cold boot and starting over from your last save that you didn’t do.

        • BorgDrone@lemmy.one
          link
          fedilink
          arrow-up
          14
          ·
          3 days ago

          Anyway, back then it wasn’t considered the job of the programming language to hold the hand of the aspiring developer as it is common today.

          But that’s exactly what it’s doing by trying to figure out what the developer meant. ‘“11” + 1’, should cause the compiler to tell the developer to to fuck themselves.

        • raspberriesareyummy@lemmy.world
          link
          fedilink
          arrow-up
          10
          ·
          3 days ago

          Executing after undefined behavior is arguably worse than terminating with an exception. A terminated script can’t leak data or wreak havoc in other ways.

    • 0x0@lemmy.zip
      link
      fedilink
      arrow-up
      14
      ·
      3 days ago

      it would be used by people that have no idea what they are doing. Clearly

      And so let’s enable these people?
      Let’s add AI to the mix while we’re at it.

      • whaleross@lemmy.world
        link
        fedilink
        arrow-up
        8
        ·
        3 days ago

        Now that you mention it, it is a bit funny how Lemmy is hating LLMs as a code generation tool while also hating on the interpreter for their own hand typed code not running.

          • whaleross@lemmy.world
            link
            fedilink
            arrow-up
            5
            ·
            edit-2
            3 days ago

            Then you do not do Javascript, because it is an interpreted language.

            Edit: or Python, or a command line shell, or any CORS, or databases, or… Well idk really what you do use honestly.

            • 0x0@lemmy.zip
              link
              fedilink
              arrow-up
              8
              ·
              3 days ago

              Then you do not do Javascript, because it is an interpreted language.

              No shit?! Wow… who would’ve known…