10 ms·
An interactive guide to learning Rust
- 2_listerine_pls 8y agoWhat's the relevance of learning Rust for someone into web development?
- mlevental 8y agorust compiles to web assembly
- stochastic_monk 8y agoWhat kinds of things could you do with web assembly that you can’t do in native JavaScript? I know very little about web development.
- eggpy 8y agoYou can run code written in a language you are comfortable with and run web code really, really fast. It's not an "either JS or WebAssembly", they can work together. Worth reading up on if you are interested - https://developer.mozilla.org/en-US/docs/WebAssembly https://developer.mozilla.org/en-US/docs/WebAssembly
- wwweston 8y agoMostly it lets you not use JavaScript, which you may or may not be excited about, depending on how much you think the problem with web development is JS.
- ameliaquining 8y agoThere are plenty of languages that compile to JavaScript. They don't save you from having to interface with the DOM and other JavaScript APIs, but neither does WebAssembly (which currently has no such capabilities at all, save through JavaScript FFI).
- eat_veggies 8y agoIt gets you very close to native performance while running in your browser and browser sandbox. That's mind-blowing. You'd still use JS for UI stuff, but WASM lets you run algorithmic or CPU intensive tasks like e.g. games, video decoding, image resizing, AI, or anything else you need fast performance for client-side.
- FridgeSeal 8y agoThere was a demo the other day of Rust outperforming JS for stuff JS usually does. Presumably this will continue to improve, so it won't even be a case of equivalent, it'll be a case of "thoroughly beats the pants off".
- kqr 8y ago"Very close to native" means "much more efficient than JS", because JS is nowhere near native. (Have we really gone so far that people hear "native" and think of the browser? Like the web browser is the machine we target, and not the metal box the end user purchased?)
- stochastic_monk 8y agoIs it pretty easy to write C++ extensions to V8? I've seen a couple of projects of that sort. I wonder if they're relatively difficult, and if that's perhaps why the push for WebAssembly has been so strong.
- xiphias 8y agoThe Unreal engine can be used innthe browsers quite effectively thanks to WebAssembly. It would be impossible to write a modern gam in JS
- thegeekpirate 8y agoI know that the web wallet for NANO uses wasm to generate hashes, and is _much_ more performant than the JS equivalent.
- OtterCoder 8y agoAs a web developer, you can write servers that take orders of magnitude less space, memory, and CPU than a similar JS server, without having to deal with the madness that is first-time C development.
- nobleach 8y agoGive me something that can run ReactDOM.renderToString() faster, and I'm all ears. Until that day (and I'm kinda hoping it comes) I'm a bit stuck.
- v_lisivka 8y agohttps://github.com/DenisKolodin/yew https://github.com/DenisKolodin/yew
- nobleach 8y agoThis does look interesting. I don't see a difference between this and any other server-side templating language though. I actually need an isomorphic representation on the client and server. (this is what makes renderToString() valuable) I guess I could be extremely careful in writing the server output, and writing the client output to match, but at that point, I'd be writing it twice... and I could use any language... unfortunately, it'd probably end up being Handlebars.
- v_lisivka 8y agoIt's for client side, not for server side. It's compiled into Wasm and delivered to client. You can use same code for server-side pre-rendering (for faster loading or for search engine indexing), but it is not main goal of Yew.
- meritt 8y agoI'm not very familiar with the React ecosystem but I thought the entire point was letting the client-side handle rendering and passing structured data via API calls? renderToString() sounds like it's doing what every scripting language and templating framework has been doing for the past 20 years?
- grayrest 8y ago> What's the relevance of learning Rust for someone into web development? Rust is a language that cares a lot about correctness. If I were particularly interested in making sure the code I wrote worked in production, Rust would be my first choice in the set of a dozen languages I know. Rust is probably quite a bit faster than whatever you're using for web development. The normal counterpoint to this is that web requests tend to be rate limited by the database. This is mostly true but using Rust pretty much guarantees this will be the case. I believe that this point isn't that compelling with current architectures but would be worthwhile in a CQRS architecture where formatted data gets pushed/cached by the web servers and servicing requests stays on-machine. Rust is one of the more compelling web assembly languages due to not needing a garbage collector. Demos exist but this is mostly in the exploratory stages. Longer term, I expect Rust to have a unified async networking stack. You can do blocking IO networking in Rust but I expect most network clients/servers to be mostly async once the Tokio stack settles. This is all expected in node but the networking libraries tend to be fractured in most languages. I don't think you should run out and switch over to Rust for general web development. There's going to be a big release in the fall that rolls up a bunch of ergonomic/convenience stuff that should make it easier to pick up and less annoying to use. I also think that IDE support will be important for a lot of people learning Rust. The situation is improving but the support is not up to par compared to more mature languages. All told, it's serviceable but I don't expect it to be particularly compelling as a web development language for at least another year or two.
- steveklabnik 8y agoWe have an entire working group dedicated to looking at the end-to-end web story this year, both backend and front end. Things are still a bit rough, but coming along nicely. The next release of Rust includes a major language feature that’s helpful when writing asynchronous code (impl Trait), for example.
- gutem 8y agoA good resource is: Rust by Exmple - https://doc.rust-lang.org/rust-by-example/ https://doc.rust-lang.org/rust-by-example/
- aviaro 8y agoI know that this is irrelevant, but is it worth the trouble to learn an esoteric language such as Rust? For me it seems a waste of time to learn a language along with its ecosystem where there are few job prospects. Right now Go seems to be on an upward trajectory, and despite its ugliness and how primitive it is, it is the job which can pays off when hunting for jobs.
- platz 8y agohttps://trends.google.com/trends/explore?q=java,golang https://trends.google.com/trends/explore?q=java,golang
- NamPNQ 8y agojava query include jav full hd
- tayo42 8y agoIf your goal for learning is to just be more employable then yeah I think its a waste of time. The language is probably worth keeping an eye on though and knowing enough about it to consider it in the future if it does pick up significant traction. And to go even more off topic. I thought the go hype was kind of dying down?
- aviaro 8y agoGo is probably going to stay. Last when I looked at job boards, I saw a fair number of Go keywords
- hardwaresofton 8y agoRust and Go, while really similar, kind of are different in use -- the key differntiator is memory management, and memory safety. For a LOT of applications, this isn't necessary or a big deal (see: just about every program written in a language that isn't c/c++). I see Golang replacing Java longterm and Rust replacing C/C++ (yeah, even C) due to the memory safety and preciseness + speed it offers. It may never be truly C speed, but from where I stand the tradeoff is worth it (and when it becomes NOT worth it, rust/c interop is SUPER easy). While I like Rust a lot, I think it's definitely not the language to learn if you want a job right now. If you want a job right now, go learn Java. Unfortunately, depending on the company you go into, you can basically throw away the next X years of your life working with uninsteresting/stagnant codebases, unmotivated peers, and clueless management -- OR you'll find companies that are using Java in a progressive way. If you want to invest in a language that will likely become a big player in the next 10 years, and is soundly written, maintained and progressed in the open, then commit to rust. Also a sidenote, most good managers/engineers realize that syntax doesn't actually really matter. Good engineers get up to speed in languages they've never used in days/weeks -- if you know the paradigms, and how to design good programs, it's a matter of just changing what you type. Knowing X language isn't what makes a good developer, it's knowing some sufficiently multi-paradigm langauge X well enough that you've moved past the basics and started re-discovering paradigms, design patterns, and answers to problems in a few problem domains.
- hardwaresofton 8y agoThe Go Tour (https://tour.golang.org https://tour.golang.org) is an excellent guide to getting started to Go, and I really wish something like that existed for rust. I have no excuse for not being the one to make it (outside of not at all knowing Rust well enough) but I selfishly wish someone would.
- spease 8y agohttps://learning-rust.github.io/index.html https://learning-rust.github.io/index.html https://rustbyexample.com https://rustbyexample.com
- hardwaresofton 8y agoRight now the second link you posted isn't loading, so I'm not sure if that is something that matches the Go Tour interface (maybe it is, and it's not loading because it's failing to init some virtualized environment for test code to run in?). My problem wasn't that good documentation wasn't available, it certainly is. The first and second editions of the rust book rust book (https://doc.rust-lang.org/book https://doc.rust-lang.org/book) are what I read through and they're great. What I meant was very literal -- I don't know of a site with Go tour's exact (or close to exact) interface, where you can run through ~30/40 slides (that's how long go tour is AFAIK) and write some code right in the browser to get a feel for the language. Rust is considerably more complex than Go, so I'm not sure it could be so succint, but I can say that at least for me, going through Go Tour really did make me feel more confident in starting a project with Golang.
- kibwen 8y agoNot sure why it isn't loading, but to get an idea it's pretty much literally gobyexample.com for Rust.
- steveklabnik 8y agoIt's not loading because I set up a redirect to its new home, https://doc.rust-lang.org/rust-by-example/ https://doc.rust-lang.org/rust-by-example/, and it seems to work for some people, but not for others. I'll have it fixed sometime soon.