5 ms·
This is really cool. I understand why all the front end tooling is written in JS but it really is a pain to deal with in my experience, especially when it comes
by losvedir 8y ago
This is really cool. I understand why all the front end tooling is written in JS but it really is a pain to deal with in my experience, especially when it comes to building and deploying. Since they're essentially just scripts you have to also install the right versions of node and npm and use npm to install the dependencies (and watch out for native extensions!). It's fairly tedious to get it all right, whenever I try it, since I'm not a pure frontend dev, and things have always changed since the last time I did it. But the promise of this is just dropping in a binary and having it all work!
I actually like JS as a programming language for the web, I just don't like scripting languages in general for command line tools.
- alangpierce 8y agoFunny, I actually view it as the opposite. swc is distributed via npm as a native extension, so you need to have the right rust version installed in order for it to work. I tried `yarn add --dev swc` like in the instructions, but it failed. I already had rust installed but I guess it wasn't the right rust. I'd be hesitant to tell my team to use it because of the extra dev environment setup. JS is a universal binary format that tends to just work from my experience. You do occasionally run into issues if you're on an old node version, but other than that it has been pretty reliable for me. But it may just be a difference in familiarity.
- steveklabnik 8y agoThis is one area where wasm may shine; you can distribute it pre-compiled, nobody using JS needs a rust toolchain installed. This is something the webpack team has indicated interest in, for example. Of course, wasm will need threading first for this project.
- jahewson 8y agoOoh I like it - yet another reason to get excited about wasm, thanks Steve!
- ori_b 8y agoHow do you verify that the distribution matches the source?
- steveklabnik 8y agoThe same way you would with anything else.
- ori_b 8y agoI do it by downloading it and building it myself, or trusting a large beaurocracy running the project to audit the source and produce signed packages, on behalf of the third party developers. Debian style. So, is npm getting a wasm build infrastructure to support this?
- steveklabnik 8y agoIt doesn't need any; you build it locally, and then put the wasm in the package when you publish.
- ori_b 8y agoThat makes auditing that the wasm matches the code pretty hard. (It's also a problem with adding minified JS). Auditing just the code is hard enough as is. :(
- PascalW 8y agoTypically Rust programs are distributed in pre-compiled form so you don't have to have a Rust compiler installed. I'm not sure why this project ships source code currently, but it could probably ship binaries too.
- nicoburns 8y agoApparently that's what the author is currently working on: https://www.reddit.com/r/rust/comments/a8i3sd/v100alpha_release_of_swc_superfast_alternative/ecb68ey/ https://www.reddit.com/r/rust/comments/a8i3sd/v100alpha_rele...
- zmw 8y agoYou mean typically “available” in pre-compiled form, right? Because Rust doesn’t have a binary distribution system per se, it is at the mercy of package managers to build and distribute binaries, or maintainers need to upload build artifacts to, say, GitHub releases (and installation process would be nonstandard as a result). I get most of my Rust binaries through cargo when on Ubuntu, except in a few cases when I really want rg (still not available in Ubuntu 18.04) but don’t want to waste 25% storage on the Rust tool chain.
- chrisseaton 8y ago> Since they're essentially just scripts What do you think is the essential difference between a 'script' and a 'program'?
- ecshafer 8y agoNot op but I think one difference between scripts and programs is some level of formal verification, as opposed to simple interpretation.
- alangpierce 8y agoIn this sense, JavaScript has advanced far beyond a "scripting language". TypeScript and Flow both allow plenty of formal verification with a type system that's quite a bit more expressive than many popular compiled languages have. It is indeed distributed as JS source code, but "simple interpretation" is an unfair description of what modern JS engines do. The JS is compiled to machine code, then introspected at runtime to look for optimization opportunities based on the real-world way that each function is used.
- jahewson 8y agoA script can’t execute itself?
- chrisseaton 8y agoYou could implement a 'script' that implements an interpreter and then run that script on itself.
- Narishma 8y agoBut you still need some interpreter to execute the initial script.
- chrisseaton 8y agoYou could compile the script to native code if you wanted to.