Thirty years later, JavaScript is the glue that holds the interactive web together, warts and all.

  • hperrin@lemmy.ca
    link
    fedilink
    English
    arrow-up
    28
    arrow-down
    2
    ·
    2 days ago

    I mean, sure, but the JS we write today is quite a bit different than the JS he designed.

    It was also heavily influenced by a number of other languages, and borrowed tons of libraries from them. The entire number and math system is just a straightforward implementation of IEEE 754.

      • hperrin@lemmy.ca
        link
        fedilink
        English
        arrow-up
        5
        ·
        edit-2
        2 days ago

        Yeah, but only kind of. It depends if you’re using the new syntax. Within new language constructs (like classes and modules), code runs in strict mode without having to use "use strict". It gets rid of some of the annoying quirks.

    • The_Decryptor@aussie.zone
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 day ago

      The entire number and math system is just a straightforward implementation of IEEE 754.

      Yeah, but using doubles for everything is its own downsides e.g. it’s why JSON “can’t” store 64bit integers for starters.

      They did add the BigInt class recently, which annoyingly you can’t use with JSON because it requires specialized handling (Because of the aforementioned issue with JSON).

      (So you “can” store 64bit integers in JSON, the spec just says not to, so people just ignore the spec. You just then run into silent truncation issues with clients that do follow it, like browsers.)

      • ThirdConsul@lemmy.ml
        link
        fedilink
        English
        arrow-up
        4
        ·
        edit-2
        1 day ago

        Safe json handling requires that all properties are stringified anyway and you cast them to their correct types (because json sucks and you can never tell what someone will put in there anyway).

        • The_Decryptor@aussie.zone
          link
          fedilink
          English
          arrow-up
          3
          arrow-down
          1
          ·
          17 hours ago

          Yeah, I actually really don’t like JSON. It looks simple but actually isn’t, that’s a bad combo.

          CBOR is much nicer, but annoyingly they made their human readable debug version of it similar enough to JSON that people assume it’s just a binary form of JSON, it isn’t.

      • hperrin@lemmy.ca
        link
        fedilink
        English
        arrow-up
        3
        ·
        1 day ago

        Yeah, I completely agree. It’s straightforward, but it’s got a lot of downsides. Everything always takes eight bytes. Even if you’re just storing 0 or 1.

        It makes handling numbers a lot simpler in most cases, though, and simplicity was the goal of JavaScript. I just wish there was a better solution than typed arrays.