• sudo_halt@lemmygrad.ml
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        12 hours ago

        Dart is fucking amazing and it compiles to native code, transpiles to JS (with some restrictions on concurrency because of web workers) and also supports WASM.

        Really if you want to write async and stream based code Dart is very good

      • festus@lemmy.ca
        link
        fedilink
        English
        arrow-up
        6
        ·
        edit-2
        21 hours ago

        Yes and no. Wasm has no “standard library” so if you wanted to use Dates, your wasm would need to have its own implemation bundled for when the user visits the page. Ditto for everything else including string support! As you can imagine having to ship all this basic functionality can bloat the wasm and slow page loads.

        You also can’t fully escape JS, as the only way wasm can interact with the page & browser are through the JS functions you write and make available to your wasm. I suppose you could take advantage of this to not have to ship your own standard library & use the JS Date implementation, but at that point why not just use JS?

        Wasm has strengths but it’s not suitable for replacing JS for everyday websites.

        • FooBarrington@lemmy.world
          link
          fedilink
          arrow-up
          3
          arrow-down
          4
          ·
          1 day ago

          How? It’s easy not to run into the common issues by using TS. What’s so bad about it that we should throw away the existing ecosystem?

          Please give arguments instead of platitudes.

          • bleistift2@sopuli.xyz
            link
            fedilink
            English
            arrow-up
            1
            ·
            22 hours ago

            You don’t need to use TS to avoid common issues. If you add an empty object to an empty array and expect a meaningful result, the problem sits in front of the keyboard.

            • FooBarrington@lemmy.world
              link
              fedilink
              arrow-up
              3
              ·
              22 hours ago

              Sure, discipline can prevent some errors. But it’s always possible to run into wrong type assumptions, and I’d say type coercion and null/undefined access make up a fairly large percentage of non-logic errors. You can entirely prevent those using Typescript, which is why it’s so useful.

              Static type analysis is always a good idea if you’re writing more than a couple lines. IMO Python is the worst offender with its kwargs etc. - discoverability and testability is just so bad if you’re following common Python idioms.

        • FooBarrington@lemmy.world
          link
          fedilink
          arrow-up
          3
          arrow-down
          2
          ·
          22 hours ago

          It unquestionably is excellent. Can you name another language in common use with a type system that’s close to the expressiveness of Typescript?