I know JavaScript is a very special boi but c’mon, you’re embarrassing me in front of the wizards.

  • bitcrafter
    link
    fedilink
    arrow-up
    19
    ·
    5 days ago

    There are tons of languages that let you represent integers directly as integers rather than having everything be a float so that you do not have to worry about this problem at all.

      • BatmanAoD
        link
        fedilink
        arrow-up
        20
        ·
        5 days ago

        Yes. Types are good. Numeric operations have specific hardware behavior that depends on whether you’re using floating-point or not. Having exclusively floating-point semantics is wildly wrong for a programming language.

        • Steve Holden@freeradical.zone
          link
          fedilink
          arrow-up
          3
          ·
          4 days ago

          @BatmanAoD IMHO both JavaScript and PHP were hacks. When introduced they were indeed excellent hacks, making difficult things possible for the first time. In as sane world they would have been discarded as prototypes, but once human greed enters the picture (and in the capitalist world that is ALL the time) sense goes out of the window and the gold rush begins. This is far from a new story (cf. California 1849).

          A collage of images relating to the California gold rush of 1849. https://www.britannica.com/topic/California-Gold-Rush

          • BatmanAoD
            link
            fedilink
            arrow-up
            2
            ·
            4 days ago

            I have managed to mostly avoid needing to code in either language, but my strong inclination is to agree that they are indeed hacks.

        • arty@feddit.org
          link
          fedilink
          English
          arrow-up
          1
          arrow-down
          7
          ·
          4 days ago

          Types are good

          Opinions vary on this topic, apparently. There’s a proliferation of untyped languages.

          • BatmanAoD
            link
            fedilink
            arrow-up
            2
            ·
            4 days ago

            There’s a proliferation of dynamically and/or softly typed languages. There are very few, if any, truly untyped languages. (POSIX shells come close, though internally they have at least two types, strings and string-arrays, even if the array type isn’t directly usable without non-POSIX features.)

            • FizzyOrange
              link
              fedilink
              arrow-up
              2
              ·
              3 days ago

              TCL & CMake are fully stringly typed. Both pretty terrible languages (though TCL can at least claim to be a clever hack that was taken far too seriously).

              • BatmanAoD
                link
                fedilink
                arrow-up
                2
                ·
                3 days ago

                Oof, yeah, those count. The fact that CMake was best-in-class when I wrote C++ professionally was…awful.