Upgrade to Pro — share decks privately, control downloads, hide ads and more …

なぜTypeScriptでつくるWebAssemblyなのか / Why using Type...

なぜTypeScriptでつくるWebAssemblyなのか / Why using TypeScript for WebAssembly

FukuokaJS@Mar 15th 2019でお話しした資料「なぜTypeScriptでつくるWebAssemblyなのか」です

linyows

May 15, 2019
Tweet

More Decks by linyows

Other Decks in Technology

Transcript

  1. FukuokaJS #8 -TypeScript- linyows / Tomohisa Oda GMO Pepabo, Inc.:

    Principal Engineer Blog: https://tomohisaoda.com 2
  2. FukuokaJS #8 -TypeScript- 9 add.wat sample.js add.wasm # ΞηϯϒϦʹม׵ $

    wast2wasm add.wat -o add.wasm # ΞηϯϒϦΛग़ྗ $ wast2wasm add.wat -v # ςΩετʹม׵ $ wasm2wast add.wasm -o add.wat
  3. FukuokaJS #8 -TypeScript- .wasmΛͭ͘Δํ๏ w 5FYUʢXBUʣʢͪΐͬͱਏ͘ແ͍͔ͳʣ w $$  &NTDSJQUFOʢϝϞϦ؅ཧʹࣗ৴͕͋Γ·ͤΜʣ

    w 3VTUPS(Pʢݱ࣮తͰͱͯ΋༗ྗʣ w 5ZQF4DSJQU "TTFNCMZ4DSJQUʢ"TTFNCMZ4DSJQUͬͯԿͰ͔͢ʁʣ 10
  4. FukuokaJS #8 -TypeScript- https://github.com/AssemblyScript/assemblyscript “AssemblyScript compiles strictly typed TypeScript (basically

    JavaScript with types) to WebAssembly using Binaryen. It generates lean and mean WebAssembly modules while being just an npm install away.” 11
  5. FukuokaJS #8 -TypeScript- TypeScript AssemblyScriptͱ͍͏બ୒ w ผݴޠΛशಘ͠ͳͯ͘ྑ͍ʢTSΛशಘ͢Δඞཁ͕͋Γ·͕͢ʣ w ݺͼग़͠ͱ࣮ߦΛಉ͡ݴޠͰ؅ཧͰ͖Δͱ؅ཧ͠΍͍͢ w

    ·ͨɺύϑΥʔϚϯεΛߴΊ͍ͨͱ͖ʹ؆୯ʹ੾Γग़͢͜ͱ͕Ͱ͖Δ w AssemblyScriptͷ࡞ͬͨwasm͸αΠζ͕খ͍͞ w ύϑΥʔϚϯε͸CʹྼΔ͕RustʹྼΒͳ͍ 15
  6. FukuokaJS #8 -TypeScript- 5ZQF4DSJQUͷίϛϡχςΟ'VLVPLBUTΛͭ͘Γ·ͨ͠ w ͍ۙ͏ͪʹษڧձΛ։࠵͠·͢ w 5ZQF4DSJQUʹಛԽͨ͠ίϛϡχςΟͳͷͰ5ZQF4DSJQUͷઆ໌΍ϝϦοτΛ ޠΔඞཁ͸͋Γ·ͤΜ w

    5ZQF4DSJQUΛ࢖ͬͨߴ౓ͳ࣮૷ͷ࿩΍8FC"TTFNCMZͷ࿩ΛؾܰʹͰ͖Δ৔ Λͭ͘Γ·͢ w ڵຯ͕͋Δਓ͸ɺ'VLVPLBUTͷ4MBDL5FBNʹ+PJO͍ͯͩ͘͠͞ʂ 19