Hacker News new | past | comments | ask | show | jobs | submit login

"took us 15 years of being flamed every time you pointed out you didn't like Javascript"

Rust is a special case here, light weight, and loved by JS devs.

I'd still "flame" anyone who wants to drop a C# or Java VM on their users.




> Rust is [...] loved by JS devs.

Is it? That's interesting, because to me the two languages seem to be polar opposites.


When you're looking for a new technology to invest in, something that's very different from your current focus can be quite valuable, as it gives you a lot to learn, a lot of new things you couldn't do before, etc.

"loved by JS devs" is maybe a bit strong, as there are a LOT of JS devs, but we do enjoy a lot of JavaScript folks getting involved with and/or using Rust, and I and others have given a bunch of talks about Rust (with and without wasm) at JavaScript conferences that were well received.


What killer features does Rust have that I'm missing out on writing web apps in plain old Javascript? The only impressions I got trying to learn Rust are that it's very inconvenient, esoteric-looking (syntax is garbled about randomly from the norm for no apparent reason other than to be different - why go to such pains shortening everything like pub and fn when fn x -> int takes up so much more space than int x?), and really just not something I'd want to go through just to write a webpage.

Static checking etc. is nice but what's wrong with things like typescript? Do we really want web libraries fragmented into a million languages?


Just because they're JS devs, doesn't mean that they're doing web development with Rust, to be clear. That's part of the whole "expanding what you can do" bit.

> randomly from the norm for no apparent reason other than to be different

This has been written about in a number of places, and I don't have time to get into it, but a lot of languages are trending in this direction with syntax because it is more regular in a language that contains pervasive type inference. It's not random.

> Static checking etc. is nice but what's wrong with things like typescript?

Typescript still has node (or deno, still V8) as a runtime, so you're still dealing with its runtime, and all the cons (and pros) there. Additionally, the guarantees you get out of TS and Rust are different, as they have pretty different type systems, even if they're both statically typed, and TS is closer to Rust than it is to JS.


A dislike of the function keyword used in a language seems like an incredibly strange and arbitrary way to make a decision about it


The Rust ecosystem shares some characteristics and idioms that are familiar and appealing to JS developers, like:

- leaning on (some) pragmatic FP concepts

- modern tooling and dependency management

- very _approachable_ and solid documentation, books etc. (see MDN, Rust by Example, Rust Book, Eloquent Javascript...)

- both can target the browser (well)

- Mozilla has a very good name in the Web dev community. I think at least; this is definitely relevant to me.


You know what’s even more interesting? Using a low level language for no obvious performance reasons in the browser (as in, what performance critical thing are you solving?).

I just remember having to do a lot of my college classes in C++, where some of our basic programs needed variables to be constantly cast into another type just to do something with it. I remember, man, I cannot wait to have to deal with this when I parse json data from an api request, bring it on.

I am JS developer, and apparently I love Rust.


I start missing Rust approximately 30 minutes into every new Typescript project I work on because there's no good alternative to Rust enums (and other benefits that come with them, like pattern matching). I can't derive basic traits for my data, like specifying equality or a canonical ordering. I can't define math operations for my calendar types, my units of measure, or my 3D graphics structs. (De)serialization of data is a minefield.

In what world is Rust a lower level language compared to JavaScript at this point?


To preface, I don’t know Rust. Just looking at that code, that stuff has references to memory. In what world is a reference pointer not lower level?

That seems like a much bigger minefield, but I’d be happy to be educated on this. I’d ask that part of that education include why I’d ever introduce this class of problems into web development.


I think that's the question most people starting to learn Rust ask. The answer is a bit hairy because of how much modern garbage-collected languages normalized data sharing. Whether you're writing Ruby or Java or C# or Python, you can always do `a = BigStruct(); a.name = 'tiny struct'`.

Rust is the first mainstream language that looks at this code and says "Hold on, are you the only one modifying `a.name`?" And the intimidating part is not the question. The question is not for you. The intimidating part is that the Rust compiler asks itself the question, and it always knows the correct answer.

What the Rust compiler is looking at is the same thing the senior programmers are looking at during code reviews at your company. The people who know who should own which data. In C, once you `malloc` a struct someone has to know to `free` it. That's the rule. You acquire a resource? You're in charge of releasing it. Or at least passing the responsibility of freeing it over to someone else.

Rustc is the ultimate code reviewer. Yes, it's super pedantic, but also, hey, it can take any amount of insults you can throw at it and still thrive. If you run out of things to call it and the code still doesn't compile, guess what, the problem is probably on your side.

I repeat, Rustc is the perfect code reviewer you could ask for. And it's available 24/7. Compilation speeds are not very fast? Ok. Compare them to code review times from your peers when using a lesser language. 10 seconds for an incremental compile doesn't seem so bad when the alternative is to get instant feedback and a comment 16 hours later that you missed an edge case.

Sorry for the big post. Thanks if you read the whole thing; kudos if you scrolled straight down. Be kind, work hard, and good things will happen.


> In what world is Rust a lower level language compared to JavaScript at this point?

The embedded one. Can't write bootloaders or kernels in JS. I mean, maybe you could but... why would you?

(On mobile here, bear with me if no newlines came through)


I see your point, but I think it only exposes the weakness of the terms "high-level" and "low-level" when used to describe programming languages. Rust is both low-level in that it can be used to write code for very small computers, but also high-level thanks to all the useful abstractions it provides.

There is no axis on which JavaScript (with or without Typescript) is a higher-level language than Rust in 2020. Rust offers a richer standard library, much MUCH more powerful facilities for modeling data, state-of-the-art (de)serialization that's one crate import and a one-liner annotation away.

I don't know who came up with asm.js, but that person definitely knew. JavaScript's destiny is to be a building block. Yes, it feels nice to write plain JS without importing any libraries. It's nice knowing the difference between `Array#slice` and `Array#splice` without looking it up on MDN. But it felt just as nice for ASM coders in the 80s to bypass a C compiler, and look where we are now.


You should try PureScript, ReasonML or Bucklescript.

You’ll get all that (and more), and it’ll be higher level.

Additionally, these languages are designed to target the web, so they have a lot of libraries and bindings for JS libraries already written.


I have. Purescript doesn't have typeclass derivation. BS technically does, but the time I tried it the compiler plugin was so raw it was basically useless to me. BS/Reason don't support operator overloading. Etc etc.

Redex's library selection is anemic compared to Crates.io, and so is Pursuit's. There are a couple of gems in both, but for any given use case it's just as likely you will have to write your own code than find a workable solution in the package manager.

More importantly, Rust has orders of magnitude higher bus factor than Purescript and ReasonML combined. Phil Freeman has long since left his project, and so will eventually Hongbo Zhang, at which point Reason will follow PS's slow downward spiral into open source limbo.

Believe it or not, I actually put a bit of thought into this. And I do firmly believe that Rust is by far the best ML-like language for the web available to the public right now. Perhaps I should finally write that blog post I keep putting off.


>> no good alternative to Rust enums

So you are missing a basic feature that a bazillion other languages can give you. I am still amazed how people think that the ML features in Rust somehow new inventions.


There are no good alternatives in Typescript. Nobody claimed that there are no other languages with enums.


Just because that was your C++ college experience, does not mean that reflects the experience of C++ today, let alone Rust today.


Look, that web app in that tutorial is roughly 200-300 lines of code in regular js/css/html, maybe less.

The onus is on you guys to tell me why I’d add cognitive overhead for simple webapps, and if it’s coming from the Rust community, I’m expecting to hear ‘performance’, in which case I’m game.

I have the same opinion on overheard in the JS churn cycle, it’s up to you to make the case why the overhead makes sense for the cruddiest of apps.

We shouldn’t coronate things willy nilly. If Rust is the one true blood prince of the C era, I expect him to reign in similar domains, but please don’t flex that power in domains where you are a sub standard solution.

All hail Rust, but jesus, slow down. That’s a simple js app.


I don't know what to tell you. It's a blog post. Simple apps are how you start to learn things. Nobody is saying that doing this is the most amazing end all be-all JS is dead and over lololol.

Some people like Rust. Some people like web apps. Some people want to use Rust to write web apps. If you don't, there are tons of other technologies you can (and should!) use to do that, and someone saying "hey if you're interested, here's how with a small example" isn't a threat to any of that.


Fair enough. The thing about the developer community is that many of the best and worst trends came from innocuous blog posts. From innocuous conference talks. It’s a blessing and a curse.

I no longer treat these posts as banal.


Personal opinion: Rust seems as bizarre choice as C/C++ would be for web apps, regardless whether it's for the frontend or backend - I'd personally much prefer to use a higher-level language like C#, F#, Go, Scala or Kotlin.


F# turned out to be a great option for us, we combine it with Elm and they work very well together.


If you feel comfortable, consider making a PR to this repo of companies using F#: https://github.com/Kavignon/fsharp-companies . Always good to have another success story!


Actually that is how we were writing web apps in 2000, with Apache and IIS plugins written in C and C++ plus some scripting language like Tcl, but I wouldn't do it today, besides providing Web UI for IoT devices.


I was there :) I have memories of writing CGI apps, and it's not something I'd relish a return to.


Well, Rust is higher level than C, but not nearly as heavy as the others you mentioned.


The qualms you describe are with static typing, not necessarily low-level languages.

And considering TypeScript is so favored as a way to "herd the cats" of JavaScript typing, it seems not everybody shares your opinion.

People go to Rust not necessarily because it's "fast" or "low-level", but possibly because it has a expressive type system that lets you be precise and correct without having to be verbose.

Sure, the fact that it can be used at the low-level and for performance-intensive applications can be a very good thing, but it is far from Rust's only merit.


I promise you that the amount of JS devs who LIKE Rust is not very high. I cannot imagine going from a language like JS or TS to the confusing syntactical monster that is Rust.

I realize this is an unpopular opinion, but JS/TS is WAY more human readable than Rust is. It's almost the equivalent of programming in C for the browser. Plus, literally anything you could ever want to use in already in the JS ecosystem and doesn't have to be reinvented in Rust.


I do not disagree on the amount of JS devs who like rust (how many even know that rust exists?), what you think is a syntactical monster I find more readable than JS (except when generics are abused, which is rare in my experience). Just by having no parenthesis around "if" it becomes a lot cleaner, and together with anonymous / arrow function syntax in js it becomes even more confusing. Its still very subjective, but if you're going just for clean syntax, I feel like python is the real winner.

Also, explicitly borrowing in method signatures is a BIG plus for me as its a lot easier to understand an API when its clear whether it mutates or not an argument, as opposed to JS where number arguments just cannot be mutated and pointer arguments (such as arrays) always can be mutated. I find understanding random github projects a lot easier in rust than js or python.

I'm not saying you should use rust, but many like rust specifically because of its readability and even find they're more productive in the long term because of its "high level" features and explicitness (although LEARNING it is a lot harder).


> literally anything you could ever want to use

...so but how's the quality of npm ecoshitstem? last time I heard you guys had some trouble in paradise, plus everything noteworthy is owned by either facebook or google, both having huge antitrust issues lately


I still hope that we'll get a lightweight (or lightweight enough, at least) .NET VM on WebAssembly. Blazor is far from lightweight currently, but it's runtime wasn't purposefully written for the task and is based on Mono.

Rust certainly has an advantage here, as it was design to not require a runtime system.


That is more an issue with the current implementation than anything else, there are other managed languages with much better AOT compilation support for WebAssembly.


I'm mostly concerned by download size. That might remain relatively large even if AOT compiled, because GC and runtime still need to be shipped with the application.


That is why linkers are relevant.

Tiny Go, D and AssemblyScript all manage small enough download sizes.

Then just like with native apps, one doesn't necessarily need to download everything at once.


>> Rust is a special case here, light weight, and loved by JS devs.

Is there any data on that?




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: