10 ms·
Next Iteration of “The Rust Programming Language” Book
- Dangeranger 10y agoThis book has been hugely helpful for me to get started in Rust. I've been following since the original "Rust for Rubyists" from Steve Klabnik. Steve if you are listening, thanks for putting all the hard work into the original book, the revision as The Rust Programming Language, and this most recent revision.
- AsyncAwait 10y agoThanks to Steve and also carols10cents for this excellent revision.
- Dangeranger 10y agoGood point, I didn't mean to gloss over the other authors and contributors.
- carols10cents 10y ago<3
- steveklabnik 10y agoThanks to you both! And very seriously, this edition could not have happened without carols10cents. I am exceedingly grateful to have her as a co-author. While the original book was largely me, this edition is very much indebted to her work.
- purple-again 10y agoSigh. Looks like it's time for round 5 of time to learn Rust(my personal failing, not meant as a slight against the language at all). Has the pace of sweeping changes to the language slowed down in the past year? I rode the Ember train from 1.4 to now and it was an extremely ehausting process to get to 2.0 with nearly every version requiring frustrating architectural rewrites. The upgrade from 2.0 to 2.8 took like 15 minutes and didn't require a single major refactor. I'm not trying to switch context away from a discussion of Rust, that's just for example purposes of stabilizing. I found myself struggling to find guides that still worked as written and I was looking at guides because I failed to become competent from the Rust book and Rust by example alone so I wasn't able to diagnose the upgrade path for the content. This has stopped my learning dead in its tracks every time. To be clear, I have no CS background or functional programming experience so I'm not the target audience and I don't mean any this as a slight against the language.
- AsyncAwait 10y ago> Has the pace of sweeping changes to the language slowed down in the past year? Absolutely, Rust has been stable since 1.0 released in May 2015 with a promise of backwards compatibility and has largely upheld that promise.
- IshKebab 10y agoYeah although that doesn't mean the language isn't changing. Just that your old 1.0 code will still work.
- ben_jones 10y agoIt's been, god, 3 years now since I've started writing large Golang applications and I've yet to look back on a project ~6 months later without noticing flaws in design/architecture/intuitiveness. You are not alone in your hurdles.
- kbenson 10y agoOn the bright side, that's am easy way to measure your growth. Look at it this way, if in six months or more if you look back on code you're writing now that's non-trivial and you can't think of a single thing you would do different what's more likely, that you were lucky/good enough to design it perfectly, or that you didn't actually learn anything from the experience (even if it's what assumptions about projects in that industry you shouldn't make going forward)? I dread the day I no longer see progress. I suspect it's also about the time I'll really find programming no longer fun.
- ekidd 10y ago> Has the pace of sweeping changes to the language slowed down in the past year? Up until Rust 1.0 in the spring of 2015, my Rust code broke once or twice a week. Since then, I've had zero breakage.
- careersuicide 10y agoAs others have said; Rust is very stable now. I started trying to learn Rust at 0.7 (maybe a bit earlier, I can only find references to 0.7 in a few projects of mine). Boy howdy did that feel like an exercise in futility. I would set it aside for 3 weeks, revisit it, and find entire language constructs had been removed. I complained about this and Steve Klabnik graciously reminded me that it was a work in progress and that the work was being done out in the open intentionally. I really can't thank him enough for that since it caused me to go from frustrated to sympathetic. As a result I decided to not write the language off. And I'm glad I didn't. After things slowed down around the betas for 1.0 it became clear that Rust was worth learning. I haven't had a chance to use it professionally, but for personal projects I find myself reaching for Rust for problems that would have caused me to have reached for C in the past. Also, Google has gotten significantly better about returning current and up to date information on Rust as well. Around 2013-2014 my biggest gripe was that I'd search for how to do something only to find advice that was woefully out of date. I haven't had that experience in well over a year now.
- ohazi 10y agoThis new book isn't finished yet, is it? If I remember correctly [0], there were several more chapters to go, and a likely timeline of months... [0] https://github.com/rust-lang/book/issues https://github.com/rust-lang/book/issues
- carols10cents 10y agoIt is not yet finished, no-- Chapters 15 to the end are merely outlines at this point.
- sbuttgereit 10y agoDefinitely not finished yet. The complete text of Chapter 19 is currently: More Lifetimes Lifetimes that depend on other lifetimes 'a: 'b stuff: subtyping Higher ranked trait bounds for<'a> Needed for closures
- steveklabnik 10y ago> a likely timeline of months... I am forbidden by my coauthor to prognosticate about due dates, but let's just say that... well, I won't say anything ;) I'm almost done with the first draft of chapter 15.
- carols10cents 10y ago> I am forbidden by my coauthor to prognosticate about due dates TRUE FACT. Everyone here knows how hard it is to estimate, we'll let everyone know once it's done instead :)
- manaskarekar 10y agoEcho all the positives about the book. Thank you. I hope the quick link to the rust playground in the sample code stays around. Also curious, is this supposed to be reflected on Rust Stable at https://doc.rust-lang.org/stable/book/ https://doc.rust-lang.org/stable/book/
- carols10cents 10y ago<3 You're welcome! The new revision of the book is using mdbook, which hasn't yet implemented playground support [1]. An RFC has recently been accepted to start the infrastructure of featuring the new book (and other resources) on doc.rust-lang.org/book, but the implementation isn't done yet. Soon! [1] - https://github.com/azerupi/mdBook/issues/29 https://github.com/azerupi/mdBook/issues/29 [2] - https://github.com/rust-lang/rfcs/blob/master/text/1828-rust-bookshelf.md https://github.com/rust-lang/rfcs/blob/master/text/1828-rust...
- lacampbell 10y agoI'm reading the section on ownership. Valgrind usually thinks my 'modern C++' code is leak free, and when it complains I understand why, so I'm not a complete stranger to systems programming. But for whatever reason I have always run into a brick wall with rusts strange compiler messages regarding lifetimes. I read the previous books bit on ownership. I'm not sure if this new version is better written or I've come across this stuff so many times that it's starting to make sense to me through pure attrition - but the picture does seem clearer to me. Particularly the "Ownership and Functions" bit. I'll definitely make use of this next time I think I have a rust shaped problem. Whether that will put me over the edge into being a rust user will remain to be seen (I have my reservations about lots of other stuff), but I appreciate they're really trying with the documentation side of things.
- msbarnett 10y agoPrior to the recent change to the error format, I found Rust's error messages incredibly obtuse too. It's gotten a lot better lately though.
- cgh 10y agoLifetimes can be confusing as hell, especially declaring them correctly. It looks like section 10.3 in this new book improves things.
- steveklabnik 10y agoAnd to be clear, 10.3 is just the intro; we have a full chapter later with the complicated stuff. We decided to do it this way so that you can write real Rust code without going "what is that syntax"; you don't need to have a full understanding of the more exotic aspects of lifetimes to write useful code in Rust.
- Ygg2 10y agoHere is something, that might ease things: https://rufflewind.com/2017-02-15/rust-move-copy-borrow https://rufflewind.com/2017-02-15/rust-move-copy-borrow
- AsyncAwait 10y agoAnother excellent book is "Programming Rust"[1], especially if you already know C/C++ 1 - http://shop.oreilly.com/product/0636920040385.do http://shop.oreilly.com/product/0636920040385.do
- msbarnett 10y agoI've been reading the early access version for a while now, and it is excellent. I hadn't had much luck with the "official" documentation, previously. Jim Blandy's writing is an exemplar for good teaching technique, and this book is shaping up to be the go-to recommendation for learning Rust, in my opinion.
- vu3rdd 10y agoI have been reading it as well. For my taste, it is a bit too verbose. I like to see something along the lines of the K&R book or the GoPL book. I was hoping that "Programming Rust" is such a book, but I was disappointed. And (may be it is just me) I like to see exercises in Programming books.
- fnord123 10y agoC an Go are pretty concise languages so they lend themselves to K&R and GoPL. Rust is a big language (like C++) and is still changing quite a bit so I don't think you'll get a similar tome in the near future. (imo)
- IshKebab 10y agoSo, if I want the paper book when it's out, and to read the early release ebook now, do I have to pay twice?
- msbarnett 10y agoSeems like it. Unfortunately O'Reilly doesn't seem to offer discounts on Book+Ebook for preorders.
- 10y ago
- proctor 10y agoI have found this book to be an excellent resource. Also I have been supplementing it with the oreilly book "Programming Rust" (early release at this point) which has also been great. http://shop.oreilly.com/product/0636920040385.do http://shop.oreilly.com/product/0636920040385.do I have had very little experience with C style languages in the past and am mostly scripting until recently.
- steveklabnik 10y agoBoth carols10cents and I, the primary authors, are reading this thread. Happy to answer any questions other than "when will it be done," as estimations are hard ;)
- TheCoreh 10y agoAre you interested in translating the book to other languages? Is such a project already underway? I can help with Portuguese
- carols10cents 10y agoYes we are! There's someone working on Vietnamese [1]. It's a bit blocked on mdbook support [2], but the translation part could start before that's done. Chapters 2, 3, 4, and 6 are effectively "frozen" for print at this point [3] so they'd be the place I'd recommend starting first! [1] - https://github.com/rust-lang/book/issues/375 https://github.com/rust-lang/book/issues/375 [2] - https://github.com/azerupi/mdBook/pull/200 https://github.com/azerupi/mdBook/pull/200 [3] - https://github.com/rust-lang/book/projects/1 https://github.com/rust-lang/book/projects/1
- deleted 10y ago[deleted]
- Synroc 10y agoI had tried running Rust for a few months now, but it didn't really clicked until I went through this book. Thanks to the great explanations of the concepts of rust, the helpful exercises and examples, I have not only since been able to contribute to the RustLang, but also am in the process of a PR for Servo, created a website using rocket.rs, and started using Rust at work. It's definitely true that the initial hump of learning Rust was more intense than other languages such as Python, but this book helped to alleviate a lot of the initial pain. Thanks carols10cents & steveklabnik!
- mevile 10y agoWhich book did you read this one or the stable one: https://doc.rust-lang.org/doc/stable/book/ https://doc.rust-lang.org/doc/stable/book/ They aren't the same.
- Synroc 10y agoThis unfinished one. Despite being unfinished, I still preferred the content over the current official one.
- carols10cents 10y agoYou're very welcome! It means a lot to me that the book has helped you so much!! <3
- mevile 10y agoPeople should know this isn't ready, and they should continue to use the current book. Chapers like this are just notes: https://rust-lang.github.io/book/ch17-00-oop.html https://rust-lang.github.io/book/ch17-00-oop.html This doesn't help anybody. Continue to use the rust book at: https://doc.rust-lang.org/doc/stable/book/ https://doc.rust-lang.org/doc/stable/book/
- steveklabnik 10y ago14 out of 20 chapters have at least a draft, so this is still useful, even if it's not complete. I generally tell people to start here and then go read the old book afterwards to get the stuff that's not there yet, if they have the energy.
- carols10cents 10y agoWe actually had someone say that the new version is so much better than the old book, even though it's incomplete, that it's like a medical trial where the treatment is going so well it'd be unethical to keep people on the placebo. A bit hyperbolic, yes, but so is "this doesn't help anybody".
- hexane360 10y agoThis has been my experience. Just the layout alone is so much better for a programmer just diving into Rust.
- jventura 10y agoAlthough I have some years of practice in programming, I always prefer to learn new languages using some kind of practical tutorial that introduces the topics as we go along. I've just finished the guessing_game tutorial and really understood the general idea of cargo, externs, associated functions, etc. Congratulations, and I hope that the rest of the book is as practical on introducing the following concepts as the tutorial was for me..
- steveklabnik 10y ago
- jayflux 10y agoIs it possible to make a PDF or an offline version? Sometimes i like to read these sort of things while i'm on the train etc. I struggled to get the current rust book working on my ipad on the train without signal.
- steveklabnik 10y agoThe current rust docs should be able to be installed offline; they used to come by default but now you need to run a rustup command. Eventually we'll provide a PDF of this, but the HTML should work offline. This edition might need some tweaks first; it's a priority for me though.
- crzwdjk 10y agoWhich rustup command is that? I could only find "doc" which opens the documentation in a browser, which is not much help if you've got no internet. Ah... I see. You have to run "rustup component list" and it'll print out a whole bunch of things that you can install like cargo and rustc and 44 different versions of std and also somewhere in there the docs. And then you have to know that that the thing you have to pass to "rustup component add" is not the string you get out of "rustup component list" (something like "rust-docs-armv7-unknown-linux-gnueabihf") but in fact just "rust-docs". And none of this seems documented anywhere in the help text in rustup itself, at least not the 1.0.0 version that I have.
- carols10cents 10y agoGood news! NoStarch will be printing an offline version soon ;) Since we're concentrating on getting the text ready for print, we haven't been able to get pdf/offline reading working yet. https://github.com/rust-lang/book/issues/218 https://github.com/rust-lang/book/issues/218
- jayflux 10y agoThanks! I would absolutely love a single webpage version, that would be even better
- beebob 10y agoI'm currently starting to learn rust (previous java and go developer). But at the moment it feels like the good old times where I was developing with an editor and api doc side by side. What is the current editor of choice for rust projects? I tried intellij-rust and atom with the racer plugin. Both seem to be in a somewhat early stage of development regarding the auto completion. Regarding the book: I like it. Has been a long time since I had fun reading such a book. With most languages I just learn by googeling one problem after another until it clicks ;)
- Ruud-v-A 10y agoI use Vim. With https://github.com/dan-t/rusty-tags https://github.com/dan-t/rusty-tags for the occasional jump-to-definition. Ctrl+N autocomplete works well enough for me.
- steveklabnik 10y agoIDE integration is a big theme of this year, so this will change rapidly over the next few months. We aim to provide plugins for everything, pretty much. Specifically, we're implementing Microsoft's "Language Server" interface, so anything that can interface with it will work well, http://langserver.org/ http://langserver.org/ has the full list, I believe. Glad you liked the book! :)
- projektir 10y agoThere's a plugin for IntelliJ: https://intellij-rust.github.io/ https://intellij-rust.github.io/
- rdtsc 10y agoThanks for sharing, very nice work. Was drawn to the "An I/O Project" section. Everyone learns differently, and I like to learn by example, that's why I often scroll to the bottom of the man page to see example before reading the description of a new command. So I'd like to see more stuff like that. Anyone know of a good Rust "Cookbook"? I found a few but there were just started with only a few examples. Also in my case, I can breeze through the start section pretty quickly, I understand the ownership basics, traits and generics separately. But seeing structs, traits, lifetimes and generic together it feels like hitting a wall. I'd welcome a resource that sort of uses lots of examples with combinations of those things.
- steveklabnik 10y agoThere isn't really anything big yet like that; I'd love to see one!
- jventura 10y agoI just replied above with a similar comment. I also learn better by following a practical example like the "guessing_game" tutorial. Didn't read the rest of the book, so I don't know if there are more tutorials, but I learn better with that because it clearly shows what one can do with the language.
- Oxitendwe 10y agoDoes this release bring us any closer to a formal specification of Rust?
- steveklabnik 10y agoThis has nothing to do with the formal specification work.
- vu3rdd 10y agoHappy to see the modules chapter and the testing chapter early enough in the book. Thanks. The new format looks a lot better, IMHO.
- JasonSage 10y agoSomething I'm curious about is why this next iteration of the Rust Programming Language book has been developed relatively hidden away from new folks, who have to continue using the old book unless they stumble upon the new one somehow. I would think that if the content of the new book does a better job at educating new users of the language, you would want that to be in front of everybody as absolutely soon as possible. With that in mind, why is the strategy to complete the new book entirely before moving over? If the new one has such big gaps that it can't stand on its own, why not try some gradual migration?
- AsyncAwait 10y ago> why this next iteration of the Rust Programming Language book has been developed relatively hidden away from new folks, who have to continue using the old book unless they stumble upon the new one somehow Because it is not done yet.
- steveklabnik 10y ago> relatively hidden away from new folks, We talk about it quite a bit on IRC, on Twitter, in the forums/Reddit, and elsewhere. I've specifically put the text out in front of new people to get feedback. > why is the strategy to complete the new book entirely before moving over? This is not _strictly speaking_ true, but it's been blocked on some other things. We haven't been able to use mdBook, the tool we use for the new book, inside the Rust repository until two days ago[1]. This was due to a number of factors that had nothing to do with the book. Soon[2], we'll be able to actually present both books on the website, and so this will be messaged a bit better. > If the new one has such big gaps that it can't stand on its own, Well, I mean, we started from scratch. The full first draft isn't even done yet! When's the right time for this, after one chapter is done? Two? Five? It's a tough question, but the actual nuts and bolts of the build process made that question moot, and now that it's 75% done by chapter count, it's all just kind of working out. Does that all make sense? 1: https://github.com/rust-lang/rust/pull/39633#issuecomment-279909845 https://github.com/rust-lang/rust/pull/39633#issuecomment-27... 2: https://github.com/rust-lang/rust/issues/39588 https://github.com/rust-lang/rust/issues/39588
- golemotron 10y agoWho is the author of this book?
- steveklabnik 10y agoMyself and carols10cents. We have also accepted small fixes and such from almost 70 other people as well https://github.com/rust-lang/book/graphs/contributors https://github.com/rust-lang/book/graphs/contributors
- indolering 10y agoAs a technical documentation nerd, I hope we can get a rudimentary JS (or WASM) IDE and compiler worked out and A/B test everything on Khan Academy for version 3.0. One impossible task at a time : )
- carols10cents 10y agoHow about you lead that effort ;)
- ZoFreX 10y agoFor the IDE part is this the sort of thing you mean? https://play.rust-lang.org/ https://play.rust-lang.org/ What do you mean by A/B testing it on Khan Academy?
- amelius 10y agoI wish they had a chapter covering how to efficiently implement graph algorithms without ending up in a struggle with the borrow checker.
- wscott 10y agoHave you read this one yet? http://cglab.ca/~abeinges/blah/too-many-lists/book/ http://cglab.ca/~abeinges/blah/too-many-lists/book/ It touches on the issues you are implying.
- bennofs 10y agoA possibility is to use a different representation for graphs, such as adjacency matrices, which are much easier to work with the borrow checker. Or just use RefCell, deferring the borrow checking until runtime. Another strategy could be to give every node an explicit ID, and then have a mapping ID -> node. Every else you just refer to the nodes by their IDs.
- makai 10y agoI like the old book much more, especially the style sheet.
- stirner 10y agoHey carols10cents and/or steveklabnik, what project was the example code in the Performance section (13.4) taken from? I'm interested in Rust and audio and especially both of them combined.
- steveklabnik 10y agohttps://ruudvanasseldonk.com/2016/11/30/zero-cost-abstractions https://ruudvanasseldonk.com/2016/11/30/zero-cost-abstractio...
- stirner 10y agoThanks! I looked through the FLAC spec a while ago and I thought it looked familiar.
- jayflux 10y agoI noticed there's no mention of Boxes. Do we still need to know about them? Or are they going away?