speice.io/assets/js/3d0fb9fd.94683b2b.js

1 line
23 KiB
JavaScript
Raw Normal View History

"use strict";(self.webpackChunkspeice_io=self.webpackChunkspeice_io||[]).push([["4384"],{2736:function(e,t,n){n.r(t),n.d(t,{assets:function(){return h},contentTitle:function(){return a},default:function(){return d},frontMatter:function(){return r},metadata:function(){return s},toc:function(){return c}});var s=n(8595),i=n(5893),o=n(65);let r={slug:"2018/09/isomorphic-apps",title:"Isomorphic desktop apps with Rust",date:new Date("2018-09-15T12:00:00.000Z"),authors:["bspeice"],tags:[]},a="Setting the Stage",h={authorsImageUrls:[void 0]},c=[];function l(e){let t={a:"a",blockquote:"blockquote",code:"code",em:"em",h1:"h1",img:"img",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.p,{children:["I both despise Javascript and am stunned by its success doing some really cool things. It's\n",(0,i.jsx)(t.a,{href:"https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript",children:"this duality"})," that's\nled me to a couple of (very) late nights over the past weeks trying to reconcile myself as I\nbootstrap a simple desktop application."]}),"\n",(0,i.jsxs)(t.p,{children:["See, as much as\n",(0,i.jsx)(t.a,{href:"https://webassembly.org/docs/faq/#is-webassembly-trying-to-replace-javascript",children:"Webassembly isn't trying to replace Javascript"}),",\n",(0,i.jsx)(t.strong,{children:"I want Javascript gone"}),". There are plenty of people who don't share my views, and they are\nprobably nicer and more fun at parties. But I cringe every time \"Webpack\" is mentioned, and I think\nit's hilarious that the\n",(0,i.jsx)(t.a,{href:"https://ecma-international.org/publications/standards/Ecma-402.htm",children:"language specification"}),"\ndramatically outpaces anyone's\n",(0,i.jsx)(t.a,{href:"https://kangax.github.io/compat-table/es2016plus/",children:"actual implementation"}),". The answer to this\nconundrum is of course to recompile code from newer versions of the language to older versions ",(0,i.jsx)(t.em,{children:"of\nthe same language"})," before running. At least ",(0,i.jsx)(t.a,{href:"https://babeljs.io/",children:"Babel"})," is a nice tongue-in-cheek reference."]}),"\n",(0,i.jsxs)(t.p,{children:["Yet for as much hate as ",(0,i.jsx)(t.a,{href:"https://electronjs.org/",children:"Electron"})," receives, it does a stunningly good job at solving a really hard\nproblem: ",(0,i.jsx)(t.em,{children:"how the hell do I put a button on the screen and react when the user clicks it"}),"? GUI\nprogramming is hard, straight up. But if browsers are already able to run everywhere, why don't we\ntake advantage of someone else solving the hard problems for us? I don't like that I have to use\nJavascript for it, but I really don't feel inclined to whip out good ol' ",(0,i.jsx)(t.a,{href:"https://wxwidgets.org/",children:"wxWidgets"}),"."]}),"\n",(0,i.jsxs)(t.p,{children:["Now there are other native solutions (",(0,i.jsx)(t.a,{href:"https://github.com/LeoTindall/libui-rs/",children:"libui-rs"}),", ",(0,i.jsx)(t.a,{href:"https://github.com/PistonDevelopers/conrod",children:"conrod"}),", ",(0,i.jsx)(t.a,{href:"https://github.com/kenz-gelsoft/wxRust",children:"oh hey wxWdidgets again!"}),"), but\nthose also have their own issues with distribution, styling, etc. With Electron, I can\n",(0,i.jsx)(t.code,{children:"yarn create electron-app my-app"})," and just get going, knowing that packaging/upgrades/etc. are built\nin."]}),"\n",(0,i.jsxs)(t.p,{children:["My question is: given recent innovations with WASM, ",(0,i.jsx)(t.em,{children:"are we Electron yet"}),"?"]}),"\n",(0,i.jsx)(t.p,{children:"No, not really."}),"\n",(0,i.jsxs)(t.p,{children:["Instead, ",(0,i.jsx)(t.strong,{children:"what would it take to get to a point where we can skip Javascript in Electron apps?"})]}),"\n",(0,i.jsx)(t.p,{children:"Truth is, WASM/Webassembly is a pretty new technology and I'm a total beginner in this area. There\nmay already be solutions to the issues I discuss, but I'm totally unaware of them, so I'm going to\ntry and organize what I did manage to discover."}),"\n",(0,i.j