• sudo_halt@lemmygrad.ml
        link
        fedilink
        arrow-up
        4
        ·
        1 year 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
        ·
        1 year 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
          1
          arrow-down
          4
          ·
          1 year 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.

        • FooBarrington@lemmy.world
          link
          fedilink
          arrow-up
          3
          arrow-down
          3
          ·
          1 year 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?

          • expr@programming.dev
            link
            fedilink
            arrow-up
            3
            ·
            1 year ago

            Let’s not get ahead of ourselves. Typescript has a decent type system, but it’s hardly state of the art. It’s impressive how they’ve managed to mostly corral JavaScript into something much more sane, but at the end of the day it still suffers greatly from the limitations of JavaScript. They’ve essentially retrofitted some type theory onto JavaScript to make it possible to express JavaScript nonsense in the type system, but there’s plenty of things that would have been designed differently had they been making something from scratch. Not to mention that the type system is unsound by design, which by itself puts it behind languages designed from the ground up to have sound type systems.

            There’s many, many things missing from the type system, like higher-kinded types, type-driven deriving/codegen, generalized algebraic data types (aka GADTs), type families (and relatedly, associated types), existentially-quantified types, and much more.