9 ms·
Rome will be written in Rust
- speedgoose 5y agoI think tools for a programming language should be written in the said programming language if possible. Rome developers will not use Rome to develop Rome, and the Rome users are less likely to contribute because they are more likely web developers and not familiar with Rust.
- nicoburns 5y agoThat's a nice ideal, but esbuild has managed to reduce build times 100x by building JS tooling in Go. Given how widely used JS it, the amount of time that would be saved by faster tools in this area is humungous.
- dmix 5y agoesbuild is also basically becoming the new standard, taking the crown from Webpack.
- hunterb123 5y agoESbuild currently replaces Babel in most workflows. Webpack is still used as the bundler. My current gripe is the lack of Babel macros support in ESbuild. I need them for translations. Afaik ESbuild does not have macros.
- christophilus 5y agoI jumped from C# to Ruby to JS/TS to Go easily. Rust has taken a lot longer to learn. Today, if I need a statically compiled binary, I use Go, simply because I can crank out a solution quickly. My point is that Go seems like a reasonable choice, if you want to easily onboard developers who are familiar with JavaScript. I don't think Rust would be as accessible.
- Zababa 5y agoI personally find Rust easier than Go. The compiler helps more, rust-analyzer is way better than the Go language server, the Rust docs are great, package management is better, and the richer type system means that it's usually easier for me to "glue the types" in my head to know what I need to do. Of course that's not universal, some people will find Go easier, some will find something else easier. But my point is just that some people will find Rust accessible.
- nicoburns 5y agoI wonder if perhaps your OOP background is holding you back with regards to Rust. I see this quite a lot in /r/rust. People from a c#/Java background struggling. I personally learnt Rust quite quickly and easily coming from a JS background. There was some new stuff to learn, but the Book covered that well, and what I consider idiomatic JS - lot's of functional iterator chains, minimal mutation, duck typing, etc - translated into Rust pretty much 1:1. Cargo is also familiar to the JS dev, and the availability of high quality libraries means that a beginner Rust dev doesn't need to learn the most complex parts until later.
- christophilus 5y agoI learned OCaml, Erlang, and Clojure easily enough. I generally prefer a functional style, so i don’t think that’s it. Haskell and Rust are the two most difficult languages I’ve learned. That said, Rust has come a long way in terms of ergonomics.
- deleted 5y ago[deleted]
- lhorie 5y agoesbuild is the current darling leading the pack, but there are also various other projects in the space (swc[0] is written in Rust, fjb[1] is written in C, bun[2] is written in zig, leveraging JavascriptCore's engine). The most significant performance-oriented effort in this space still leveraging JS that I know of is kataw[3], and while that's quite fast compared to babel, it's still within an order of magnitude from babel. Kataw itself is a CST-based implementation that was created to outperform seafox (a AST-based parser by the same developer), which itself is an iteration over several other perf-oriented parser projects. Babel gained popularity due to the crazy amount of churn in grammar over the past few years, but more and more I think the dust is settling, and flexibility is no longer the name of the game, making an AST-based implementation less appealing. The Rome team must be feeling the heat if the data structure design choices are being informed by performance. I highly doubt someone will be able to compete in performance using a JS implementation in today's landscape. [0] https://github.com/swc-project/swc https://github.com/swc-project/swc [1] https://github.com/sebbekarlsson/fjb https://github.com/sebbekarlsson/fjb [2] https://bun.sh/ https://bun.sh/ [3] https://github.com/kataw/kataw https://github.com/kataw/kataw
- yewenjie 5y agoIs there a benchmark and comparison of these new tools somewhere?
- kuberlog 5y agoThere is a big difference between writing in Go vs Rust. Any intermediate/advanced webdev will feel competent in Go in a matter of days. This is definitely not true with rust.
- whimsicalism 5y agoDisagree - I think mypy for python and esbuild for js are great examples of why this is not always the case.
- judge2020 5y agoMaybe so for small languages/projects, but it won't matter if it gets popular enough. Some of the biggest languages like Python and PHP still have their core components written in C, as opposed to some 'write the core in our language then create a transpiler'. I'm sure speed being the focus instead of DX (developer experience) will be appreciated by all the people that won't ever touch Rome except as an end-user.
- Jtsummers 5y ago> I think tools for a programming language should be written in the said programming language if possible. This is a popular sentiment which I've never understood. Should all JS tools be written in JS? What if you already have an 80% solution written in F# thanks to some other work that can be reapplied to JS, should that solution be rewritten? Should we have IDEs predominantly written in their target language?
- mynegation 5y agoIn a twist of irony, the most popular IDE for Rust is written in Typescript (but of course powered by rust-analyzer, written in Rust)
- javajosh 5y agoI tend to agree, but in this case I think it's okay. The runtime of the web (the primary target of most js today) is a very different animal to more traditional runtimes. It is a "gooey" place and highly specialized and just...weird. What other environment pulls components and data from around the world at runtime? It's also tempting to think that Rust is just better than Javascript for the web too, and you can target the browser with a WASM bundle. I think that's wrong, too. The developer story in the web is weird, but it works and you give up a lot by using WASM. I also think from a societal standpoint (un-obfuscated) Javascript is the healthier choice, since it lets people learn from each other. So, basically: yes, Rome, a dev tool, will be written in Rust, and it will help people write better Javascript, and that's okay.
- ironmagma 5y agoAs a JS developer, I don’t trust the users of the ecosystem enough to develop the tools properly in JS.
- Zababa 5y agoI think that's actually one of the sweet spots of Rust. I find it way more accessible to web devs, while C++ is scary for me. This in turn allows you to have very performant tools that are easily distributed as a single binary. Go has the same qualities, as ESBuild proved. Both also can be compiled to WASM, so that makes the distribution even easier.
- fabiospampinato 5y agoAre you saying that we should have a JS-based JS engine in browsers? Sometimes performance is more important than hypothetical additional external contributions.
- paxys 5y agoA JS engine in a browser isn't built for JS developers but rather every web user. A better example would be the TypeScript compiler, which is written in TypeScript and still very fast.
- fabiospampinato 5y agoI'd argue the JS engine in browsers is _also_ built for JS developers, and even though we are definitely a minority compared to all the internet users it's important to underline that most of the stuff currently available online, for better or for worse, wouldn't exist without developers writing it. Like the average user in fact couldn't care less about what languages websites are written in, but if browsers shipped only a brainfuck compiler I'm sure there would be a lot less development happening on the web, in some sense JS developers are the target users of JS engines. I think this is literally the first time that I hear anybody saying that TypeScript is very fast. It's no coincidence that the top open issue in Deno's repo is literally titled "TypeScript compiler in Rust" [0]. The developer behind swc is even rewriting the whole type checker in TypeScript [1]. A lot of people, myself included, think that TS can get excruciatingly slow, in a large-enough but not really huge codebase, in a way that probably wouldn't happen if it were written in something like Rust with a big focus on performance. [0] https://github.com/denoland/deno/issues/5432 https://github.com/denoland/deno/issues/5432 [1] https://github.com/swc-project/swc/issues/571 https://github.com/swc-project/swc/issues/571
- okamiueru 5y agoAny project / tool should be written in the language most suited for the problem, while also pragmatically factoring in prior experience of those who would do said work. Is there really a significant overlap between programming tooling usage, and development of the programming tools? The case where I see most rampant abuse of this is npm/node commandline tools. Written in/for an environment because it is mostly used by people in that environment, and not because it is particularly suited for it. If it wasn't for docker, all those tools would be tied to a exceptionally messy runtime, and wasted effort. They also won't be included in any normal distribution either. It makes any tool written in node to come across as an amateurish and hacked together attempt. Regardless of how well and robust it is. I'm sure there are good reasons for it, beyond my understanding, since node is something I've always avoided due to red flags all around. But, I digress. If the memory and runtime model isn't suited for the requirement of the tool, and language doesn't allow for a paradigm that matches well with the problem domain... You've picked the wrong language.
- marcosdumay 5y agoIf a language goal is not to support language parsers, what good does it do if you write your parser in it? It certainly does not benefit from the extra focus the developers dogfooding the language will bring. On the other hand, there is a real chance that the dogfooding will be harmful and make the language lose focus. If it's goals do not include a good systems interface, the same applies. And Javascript's goals don't include either.
- CodeIsTheEnd 5y agoThis justification -- Rome should be written in JS otherwise Rome users are less likely to contribute -- irresponsibly focuses on a secondary goal of the project, at the cost of the primary goal, which is to be a end-to-end toolchain for one of the most popular languages in the world. Using Rust promises performance and stability, key features for the thousands of engineers that will be running Rome as a critical part of their workflow. The vast majority of those developers would prefer that the tool runs faster and has fewer errors over having a lower barrier to entry for contributing. "Contributing" may also encompass the plugin/extensibility ecosystem around the tool, and can be closely tied to the underlying implementation language. This functionality has been integral to the growth of things like Babel and Webpack, but it seems in this case Rome is trying to replace much of that very ecosystem. I there are some toolchains that may prioritize "barrier of entry to contributions" -- new languages, or niche communities for example -- but I don't think it's an appropriate priority for a toolchain for a massively popular established programming language with $4.5 million in funding [1]. [1]: https://rome.tools/blog/announcing-rome-tools-inc/ https://rome.tools/blog/announcing-rome-tools-inc/
- xcambar 5y agoThe authors mention they will be more productive with Rust. I'm no Rust expert and I take their word for trustworthy, but nonetheless, they won't build Rome in a day.
- kimi 5y agoAs Rome was not built in a day, at least they can't complain about taking forever to build.
- ignoramous 5y agoNo one should complain if rewrites blow up, because they often tend to: https://www.joelonsoftware.com/2000/04/06/things-you-should-never-do-part-i/ https://www.joelonsoftware.com/2000/04/06/things-you-should-... Requires more discipline, patience, and humility than most teams could muster up.
- brundolf 5y agoIt's also interesting because the author of esbuild actually started out with Rust and eventually switched to Go because it was more productive. I think that was mainly due to how much garbage a compiler generates and therefore how much a garbage-collector helps with ergonomics, but still, interesting data point Edit: I'm not saying the Rome devs necessarily made the wrong decision. I really like Rust and I dislike some of Go's major choices. But I'm also a pragmatist and thought this would be an interesting point to discuss.
- Cryptonic 5y agoRust's pedantic safety rules (enforced by the compiler) give you a hard time as somebody who expects to be productive quickly. It's as if you learn programming a second time in your life, but this time with different focus. This is not an experience for everybody, to understand that you did dangerous things in the past and now are enforced to avoid them. It is much easier if you have a Mentor or a ively seek out for the helpful online community by the way. About Go, well if you are not tageting C-like performance and not looking for pedantic savety, maybe it might be a better option. Interesting is that the wise people behind both languages decided against inheritance and deal with it in their own ways. It's worth giving Rust and Go a chance imao. Especially as C/C++ developer you can learn a lot to get better when coming back with more sensibility about ownership, lifetime and composition. It will make you grow as a programmer, especially Rust if you ask me.
- brundolf 5y agoAlways excited to see more Rust usage, and this was actually a super interesting post on modern compiler design, but I failed to see how the two topics were very related? The post felt weirdly disjointed
- javajosh 5y agoRome wants to be comprehensive js developer tooling, replacing the current panoply of eslint, webpack, and so on. They've determined Rust is a better language for writing that kind of tooling.
- brundolf 5y agoRight, I know that/it's clear, I just thought it odd the way the post jumped between these two different aspects of the project that are only loosely-related at most
- mirekrusin 5y agoWhy not close the shop and join deno?
- nobleach 5y agoIs Deno trying to solve these problems (Linting, Formatting, Polyfilling and bundling)? I was under the impression that Deno was a node-like runtime using Rust bindings to libuv instead of C++.
- acdibble 5y agoDeno linter: https://deno.land/manual/tools/linter https://deno.land/manual/tools/linter Deno format: https://deno.land/manual/tools/formatter https://deno.land/manual/tools/formatter Deno bundle: https://deno.land/manual/tools/bundler https://deno.land/manual/tools/bundler Not sure about polyfilling, but it might leverage TSC for that? Added bonus is Deno compile, for creating standalone executables: https://deno.land/manual/tools/compiler https://deno.land/manual/tools/compiler
- wayneftw 5y agoAll of those packages are for running things in Deno or creating modules that will run in Deno. Rome is for building frontend packages and apps.
- crowlKats 5y agoDeno uses tokio instead of libuv. Deno comes with a large amount of tooling built-in: formatting, testing, linting, documentation, and other
- nobleach 5y agoOh that's awesome! Thanks!
- jamescostian 5y agoI wonder if they will write a TypeScript type checker in rust? TypeScript currently only has one serious implementation that actually checks types (esbuild, for example, does no type checking). Getting another one that's written in rust would be tremendously helpful for type checking times! But, on the other hand, if they don't write a type checker in rust, we may still need `tsc`. Since Rome won't be written in JS/TS, I worry that calling The official TypeScript compiler from rust may be prohibitively expensive, necessitating users to run a separate `tsc` process. That goes against Rome's goal of having a single AST generated once by a single tool
- flaque 5y agoThere already is one, and it’s used by Deno! https://swc.rs/ https://swc.rs/
- thdxr 5y agoThis actually only builds and does not type-check similar to esbuild. The author is working on a proprietary type-checker in Rust though
- jamescostian 5y agoThat doesn't support type checking, see https://github.com/swc-project/swc/issues/571 https://github.com/swc-project/swc/issues/571 You'd still need to run `tsc` to check types even if you used swc
- flaque 5y agooh, good point, apologies
- caspervonb 5y agoWe use swc a lot but not for type-checking, that is still done by tsc loaded into a snapshot (precompiled v8 state). There is a type-checker in the works tho https://stc.dudy.dev/docs/status/ https://stc.dudy.dev/docs/status/
- mastrsushi 5y agoThere’s not much the author listed that can’t be applied to typescript or any other JS compatible languages. Rewriting their JS tools in a language as low level as Rust is asinine. I have no doubt it’s a weak attempt to indulge in their fanboyism. I wouldn’t be surprised if this change causes massive technical debt, but people seem to love Rust, so there’s gotta be someone for this role.
- junon 5y agoFirst let me say I really dislike Rust. Personal preference. However, having worked with Node for almost 10 years now, with a number of bundlers, most in Javascript but some in other languages, Javascript tools rarely win the performance race. We switched our medium-sized app from Rollup (Javascript) to ESBuild (Rust). Our build times went from 5-15 minutes, to just under 1 second - with full feature parity. I'm sure a lot of this boils down to algorithms and whatnot, sure. But I still would like to think it's in part the language choice, too.
- mastrsushi 5y agoBut how much do those type of performance benefits matter to JS tools like a linter? The only positive they’re getting out of a native compiler language is unnoticeable performance boosts.
- Shish2k 5y agoSpotting lint problems in real time as I type is way more useful than spotting them after I submit a pull request and wait 10 minutes for the CI system to kick in :)
- junon 5y ago> But how much do those type of performance benefits matter to JS tools like a linter? A lot, I don't see how this is really a question. > The only positive they’re getting out of a native compiler language is unnoticeable performance boosts. 5 minutes to 1 second of build time for the same features isn't what I'd call "unnoticeable".
- thdxr 5y agoI'm really excited about this direction, a few years ago I asked the question "who will be brave enough to write JS tooling not in JS" and it seems a lot of projects now exist. That said, I do not believe Rome will be the winner here. If they were willing to undertake this giant project initially _without_ the benefits of using a faster language, I'm not sure what the vision was. Really excited about esbuild, swc and bunjs
- kiliancs 5y agoI suspect the focus was initially on creating a coherent toolset, but that is not going to be sufficient for Rome to compete performance-wise with current tooling, hence the switch to Rust.
- optymizer 5y agoA good indication of someone's lack of experience is hearing something along the lines of "I used X, but now I'll rewrite it in Y", and then they proceed to explain all the hypothetical benefits of the two birds in the bush, instead of the one in the hand. After working on a project for a while, it's natural for people to start seeing inefficiences or bad trade-offs in the code/architecture/language/project/etc. The first reaction is usually to think that if only they could throw that away and rewrite it, preferably in a better language, it'll be so much better, because it has to, right? All those shiny bew features will surely make your product so much better. But it's never the tool that got you in that spot. It's you - your decision making process and your ability to create a product. If the language is actually a problem, you made a bad decision by picking that language. If the code is bad, you didn't code it well. If the architecture is bad, you didn't design it properly. So unless you really learnt your lessons, changing the tech is just going to get into a different swamp. Do not rewrite the project if all you can say is that you don't like the state it's in. Refactor. If you know exactly what mistakes you've made and how to fix them, but fixing them requires a large portion of the project to be refactored, then that's a good case to say that since you've learnt from your mistakes you have a good chance of rewriting the project to fix those mistakes but _without introducing additional risk_. If nothing else, changing the language discards your expertise in the previous language. There is also no reason to believe that changing the programming language will yield a better tool than before. Sure, you got some learnings from having written v1, but you're also throwing away everything that went right. At the end of the day, just admit to yourself that you want to rewrite your project in Rust because you like Rust and want to write Rust code now. That's it. There is need to publicly justify that it's such a great choice and it will make everything better. It won't. Software is still software, and it's limited by your imagination and ability. People have written excellent tools before Rust came along and will write them after Rust is long gone, because the language is a tool, and the only thing at the center of your project is you, alone with a text editor, wanting to make something happen. So make it happen.
- kiliancs 5y agoA good indication of someone's experience is that they don't have hard rules and are able to analyze and see the nuance in each situation. This is to say, I wouldn't be so fast to judge.
- secondcoming 5y agoI'm not sure how moving from JS to an systems engineering language would make anyone more productive. I bet they just wanted to use Rust, because why not?
- marcins 5y agoIf you read the post, it’s because they’d made the decision not to use any third party dependencies in JS due to perceived problems with quality and correctness, and they found Rust crates to not suffer as much from these problems. So their productivity mostly stems from not having to rewrite their dependencies anymore, not so much just the switch to Rust itself but the whole ecosystem.
- pdimitar 5y agoWhy would it not make them more productive?
- bgorman 5y agoI wonder why they didn’t go with OCaml, this type of task seems like it is the bread and butter of the ML family.
- Scarbutt 5y agoToo esoteric.
- d4mi3n 5y agoI see a lot of discussion on Rust vs $LANG, but nobody seems to be discussing what I think is the meat of this announcement: 1. Fewer tradeoffs for third-party dependencies Most JavaScript/npm packages have to balance a lot of different concerns for many different kinds of users. They are forced to make tradeoffs around code size and performance that we aren’t interested in. Rust crates, on the other hand, are generally making tradeoffs that much closer align to our needs. 2. Correctness is built-in to the standard library and in most popular crates We were creating our own APIs that focused on correctness instead of using third-party JavaScript dependencies. Rust, and its community, places a lot more focus on correctness without paving over edge cases that we need to worry about for Rome. 3. Trait/Module system allows us to make better use of dependencies Rust’s trait system is a powerful way to create abstractions over any piece of data without overhead. It allows us to deeply integrate third party libraries. It also allows libraries to create APIs that are much more incremental, safely exposing more surface area without creating a need to make breaking changes. My takeaway here is that the Rome team was getting tired of rewriting stuff from scratch but the nature of the JS/NPM ecosystem made it hard to use 3rd party code without losing control over Rome's performance. I'm not sure how valid this claim is, but it is well known that the history of NPM modules puts the ecosystem in a weird place where libraries are expected to optimize for usage on both server environments (Node, Deno, etc) and browser environments (Firefox, Chrome, etc). This tradeoff is not without costs--I believe it's one of the big reasons we see dependency bloat in the NPM ecosystem. I'd love to see more discussion around this topic and what other folks' experiences with these kinds of problems are.
- thejameskyle 5y agoSomething I didn't mention in the post that might deserve calling out specifically is that Rust maintainers actively decide to work in crates instead of in std for many things. This means that you have the language designers themselves maintaining some of the most important crates in the ecosystem, and baking it into their process to iterate on the language itself. The result is really high quality crates and the community is better for it. I'm not trying to dunk on JavaScript/npm packages though, or anyone involved in developing the language. Clearly the JS community has found success and is meeting a lot of people's needs. We can accept that Rome's requirements are different than most people using JavaScript.
- ddoolin 5y agoIt seems like a lot of JS developers are finding shelter in TypeScript and Rust. I think this is good news. TypeScript has an awesome type implementation on top of what we already know, and Rust obviously has huge performance benefits over JS. I'd not had much strongly-typed or compiled language experience before, but recently started using both simultaneously for a new project and it's really been a great learning experience and stepping stone. I chose Rust over the team's familiar C++ for deterministic and stochastic model simulations and now they loathe working on former projects. The transition to TypeScript for those of us who were primarily web developers was pretty seamless and the exposure certainly made understanding features of Rust, etc. a lot easier. I don't really see any serious negatives in this move. If the likes of Rust and Go pull more web developers into the world of safer and more performant languages and systems, what's the issue?
- leerob 5y agoRelated: Next.js is rewriting its core with a Rust-based compiler. SWC (JavaScript and TypeScript compiler written in Rust) will replace two toolchains used in Next.js: Babel for individual files and Terser for minifying output bundles. Early tests are showing twice as fast builds, with further optimizations to come. We're betting on Rust as the future of JavaScript infrastructure.
- pdimitar 5y agoSuper exciting, thanks for sharing!
- jerrygoyal 5y agoia anyone using roam tooling for their project instead of eslint, etc,.? would love to hear some feedback
- strager 5y agoI tried Roam's linter. I hit bugs with the CLI and the LSP server. I fixed and reported a few of the bugs, but eventually I gave up trying.
- satvikpendem 5y agoThis reminds me of a blog post by 2ality [0] talking about how the rise of JS tooling in non-JS languages signals a future where JS becomes much faster, simply due to the languages being compiled and not interpreted. However, I am also reminded of a post I recently submitted called "We rewrote everything in Rust, and our startup still failed. [1]" I don't necessarily think this is the case with Rome however, as they are actually solving a crucial need - performance - rather than most companies who'd undergo rewrites which don't focus on their customers' true needs but instead simply want to rewrite for the sake of rewriting, whether it's for fun or for keeping their devs happy. I am curious though why they wouldn't merge with SWC which is also written in Rust, or other efforts to write JS tooling in other languages. [0] https://2ality.com/2020/10/js-plus-other-languages.html https://2ality.com/2020/10/js-plus-other-languages.html [1] https://outline.com/yr7ZBS https://outline.com/yr7ZBS
- caspervonb 5y ago> We quickly realized we might actually be more productive in Rust. The compile times will catch up with you soon enough! enjoy them while iterating is fast! ;)
- pictur 5y agoI'm sorry for this project. such an early rewrite will probably be the end of the project. i hope i'm wrong.
- Cryptonic 5y agoWhole Italy should be written in Rust. And the world is next.