JS to Rust WebAssembly the hard way ... and the easy way

Поділитися
Вставка
  • Опубліковано 5 вер 2024

КОМЕНТАРІ • 17

  • @contextfree
    @contextfree  Місяць тому +7

    By the way, Node does have fetch support these days, which I'd actually missed, but it's still missing "file:" fetch. As mentioned in the video, Bun and Deno do both work out of the box on the demo as presented, including automatic support for both ES modules & TypeScript.

    • @arjix8738
      @arjix8738 Місяць тому +1

      Huh, I doubt browsers allow fetching file: either.
      Node's fetch API is compliant with the browser's fetch API. Same specification and standard

    • @contextfree
      @contextfree  Місяць тому

      The code is written to be relative to the js module URL. Running from command line here means file. That's all.

  • @lucatracanna6955
    @lucatracanna6955 Місяць тому +9

    Almost the same situation in C/C++: you either use Emscripten which does most of the job for you OR you do it manually with Clang (which doesn't port the standard library so if you want to use std::vector, std::map etc. you gotta write them yourself). It would be nice to see a video about that too.

    • @contextfree
      @contextfree  Місяць тому

      My understanding is that emscripten also wraps lots of different libraries. It seems to be a very large scope project.

    • @contextfree
      @contextfree  Місяць тому

      Also, plain old rust compiling to wasm gets std Vec and most things. It's just the interop part that's awkward without extra tooling, at least for what I've seen so far. So that's also a difference.

    • @rcelyte
      @rcelyte Місяць тому +1

      wasi-sdk provides a mostly exhaustive implementation of the C and C++ standard libraries without Emscripten, and works in-browser if you don't depend on platform features like file I/O.

  • @codeman99-dev
    @codeman99-dev Місяць тому +11

    Seems WASM is coming back into general conversation again. Feels like it has been quiet since the announcement of WASM garbage collection. Maybe I stopped paying attention?

    • @contextfree
      @contextfree  Місяць тому

      To me, that's still a new announcement. I guess I work on a slower time scale. I have looked at the gc spec a little, though.

  • @rcelyte
    @rcelyte Місяць тому +1

    4:31 Minor correction: DataView getters will *always* use big endian unless `true` is specified, regardless of host endianness.

    • @contextfree
      @contextfree  Місяць тому

      Thanks much for the correction!

  • @Germisstucklmao
    @Germisstucklmao Місяць тому +2

    This is pretty interesting. How complex is webgpu?

    • @contextfree
      @contextfree  Місяць тому +1

      Webgpu requires lots of manual and fiddly effort. New Taca plans give less control for a much easier time. And my new js implementation is directly on webgl2. But I'm currently still working on getting wgpu working for the native version.

    • @Germisstucklmao
      @Germisstucklmao Місяць тому

      Why not use webgpu for the web as well?

    • @contextfree
      @contextfree  Місяць тому

      It's only available in Chrome and not on Linux. Presumably someday though.

  • @stevenhe3462
    @stevenhe3462 Місяць тому +1

    🌮🌮🌮
     🦀