
The Advanced Rust Programming Language Book Draft - adamnemecek
https://doc.rust-lang.org/nightly/adv-book/
======
Gankro
Author here. Didn't really want to post this to the wider programming
community yet, but oh well.

This is basically the first draft. Lots of errors and TODOs.

Source is here if you want to file issues or patches:
[https://github.com/rust-
lang/rust/tree/master/src/doc/tarpl](https://github.com/rust-
lang/rust/tree/master/src/doc/tarpl)

~~~
adamnemecek
Changed the title to "The Advanced Rust Programming Language Book Draft".
Better :-)?

~~~
Gankro
Thanks!

------
jimmoores
Great to have a resource like this. By way of providing some hopefully
constructive feedback, the language seems a bit excessively informal: "Safe
Rust is For Reals Totally Safe. Unsafe Rust, unsurprisingly, is not For Reals
Totally Safe. In fact, Unsafe Rust lets you do some really crazy unsafe
things". I get the idea that's it's trying to be friendly and street, but it's
a bit out of place in a document like this (I was just waiting for 'shizzle'
to pop up). There also looks to be an excessive use of emphasis (italics).

~~~
Gankro
Haha, yeah I like to be a bit silly here or there. I might tone it down, but
on the other hand I find it makes the text a bit less dry to not take yourself
_too_ seriously. :)

re italics: [https://github.com/rust-
lang/rust/pull/27414](https://github.com/rust-lang/rust/pull/27414)

~~~
unfamiliar
I see what you are aiming at, but honestly this informal style is hugely
irritating to read for me, and is probably the main reason I haven't delved
further into rust - I just can't spend more than 5 minutes reading the guide.
It seems like it takes twice as long to get the information across because
there are constant "quirky" remarks, weird and anthropomorphisations of
computers or code, or "humorous" observations about coders. I agree the
italics are annoying; there really isn't any need to stress particular words,
people can read and if you write well it will be pretty obvious which words
are supposed to be emphasised ("really" _really_ doesn't). In general the tone
comes across as a mix between cocky and patronising ("this book contains
_invaluable_ information" \- how modest).

For example, the two opening paragraphs basically told me nothing that the
title didn't. And then we have things like this:

>With that said, Rust is _totally_ a safe programming language.

What the hell kind of a statement is this to put in an advanced programming
book? It adds nothing, sounds childish. Just let the content speak for itself,
stop trying to be relatable or funny.

Sorry if I'm coming across as bitter and whiny, but I am disappointed that
this is suffering from the same problem as the guide for me. I honestly think
it would be good for the project to have someone else to be writing these
guides.

EDIT:

> Safe Rust is For Reals Totally Safe.

> That's totally awesome.

> Low-level programming cares a lot about data layout. It's a big deal.

> TODO: ALL OF THIS OMG

cringe...

For some constructive criticism, I think Julia's docs really hit the right
mark. Here is their introduction:
[http://julia.readthedocs.org/en/release-0.3/manual/introduct...](http://julia.readthedocs.org/en/release-0.3/manual/introduction/)
There is _a lot_ of information on that page, a clear mission statement, not
too dry but still manages to speak to you like an adult.

~~~
muraiki
I guess there are at least two schools of thought for programming books.
There's the one you mention, and there's a different approach that you'll see
here and in other books like Learn You a Haskell for Great Good, Brave
Clojure, and perhaps most famously, why's (poignant) Guide to Ruby.

I think that there's a place for both of these styles in the world. And
perhaps this style can appeal to a person who struggles with the stereotype of
computer programming as a serious, dry affair, bereft of human expression, the
job of coder cogs in programming factories. Perhaps you could say that the
serious style appeals to more people, but maybe that is actually a criticism
of the population of programmers, and not of the work?

In regards to sounding childish, I find that in general to be an unusual
criticism. Perhaps there are people who speak this way as adults simply
because that is who they are? I guess C.S. Lewis sums up my feelings about
"being childish":

Critics who treat 'adult' as a term of approval, instead of as a merely
descriptive term, cannot be adult themselves. To be concerned about being
grown up, to admire the grown up because it is grown up, to blush at the
suspicion of being childish; these things are the marks of childhood and
adolescence. And in childhood and adolescence they are, in moderation, healthy
symptoms. Young things ought to want to grow. But to carry on into middle life
or even into early manhood this concern about being adult is a mark of really
arrested development. When I was ten, I read fairy tales in secret and would
have been ashamed if I had been found doing so. Now that I am fifty I read
them openly. When I became a man I put away childish things, including the
fear of childishness and the desire to be very grown up.

~~~
unfamiliar
I agree that there is a place for both styles in the world. Unfortunately when
it comes to rust most of the tutorial seem to be in this style, and I thought
at least the "advanced" guide would be more "sensible". I enjoyed Learn You a
Haskell, but that was an introductory text. If I am reading an "advanced" text
on a systems programming language I probably expect it to be a little more
formal.

>In regards to sounding childish, I find that in general to be an unusual
criticism. Perhaps there are people who speak this way as adults simply
because that is who they are?

First off, maybe it wasn't the best word for me to use. However, the second
statement is a tautology; of course if they are childish then that is "who
they are": childish people. The term to me doesn't denote an interest in
"childish" things, like the CS Lewis quotation seems to say. Rather it denotes
"not fully emotionally developed" which is usually a judgement placed on their
current behaviour. You can read all the fairy tale books you like, I don't
care. But if you start exhibiting the negative behaviours typical of children
- selfishness, irresponsibility, etc - then yes, you are a bad person and
deserve to be called out for it. (I'm not suggesting this at all about the
author - this is now a separate discussion.)

~~~
muraiki
I was reluctant to quote Lewis because there is more context to his ideas than
can be conveyed in that quote. The negative behaviors you describe aren't
typical of just children: they are typical of all of fallen, broken humanity.
It's just that children are more honest in being direct about those negative
behaviors. :)

Since we associate these negative behaviors with "childishness," we risk
throwing out the good with the bad: we lose imagination, wonder, honesty,
playfulness, etc.

I realize that you aren't suggesting the author has those negative behaviors.
I'm only trying to provide a greater context to Lewis' quote. Perhaps I should
have just stated this argument on my own; I apologize for any confusion.

------
hacker_9
Author no doubt understands programming, and the ins and outs of Rust, but has
a harder time conveying his ideas in written English.

For one italics are used so much to the point of being annoying after the
first 3(!) paragraphs. When something is written in italics, the reader puts
more emphasis on the pronunciation of the word, lengthening the amount of time
they read it for. Do this enough times and the writer starts coming across as
sarcastic, and even seems to be mocking the very language constructs he is
writing an _advanced_ tutorial about!

No doubt this was not intended, and I would urge the author to take a few days
off before coming back and re-reading their work, so they can try and see it
from the perspective of an outsider.

~~~
Manishearth
> No doubt this was not intended,

I'm pretty sure the informal tone was very much intended. There's not much
sarcasm there though.

~~~
hacker_9
Yes it is informal, but the overuse of italics makes it come across as
mocking, which is what I was referring to.

------
felixangell
Pretty good read, even if it's a draft. Only thing that bugs me a little is
the informalities, and reading "That's it." after something was explained.

------
axaxs
I apologize to ask this, but what is Rust's end game or claim to fame? It
seems to a beginners eyes as if it is a new, far more complex c++.

~~~
Gankro
Rust is safer than most languages (I'd argue it's even safer than
Java/JS/Python/Ruby) but as fast and low-level-capable as C++. If that's not a
big deal I dunno what is. (Also it has a really cool concurrency/parallelism
story IMHO)

I'm not sure you can argue that Rust is far more complex if you actually
understand C++ sufficiently to write correct and performant programs.

But the really great thing about Rust is that _you don 't actually have to
understand the language_ to write correct and performant programs. The
compiler will stop you in your tracks every time you screw up. Also there's
way less performance foot-guns by default. Everything is moved instead of
deep-copied by default, and you can take random pointers into things without
having to worry about it.

But it's true, complicated things are complicated to express, which seems...
natural to me? I dunno what people expect. But simple things are actually
really simple.

For instance, here's an early version of a library I'm working on for decoding
gifs: [https://github.com/Gankro/gif-
rs/blob/master/src/lib.rs](https://github.com/Gankro/gif-
rs/blob/master/src/lib.rs)

There isn't a single lifetime in sight. It's also really nice and readable
(being able to ergonomically talk about bit and byte patterns was a big boon).
Granted the library is fairly naive (it's a pull parser, but it later became
clear I wanted a push parser for Servo). But I think it's a great argument for
_simple things are simple_.

Rust gets crazy when you demand on writing extremely generic code like Hyper,
because Rust leans heavily on static verification. But generic code is just
always going to be cray-cray (See: Haskell lenses, C++ Boost, Scala
collections).

~~~
furyofantares
Thanks for the link to that code, it was a pleasure to read. I then went back
and read a GIF decoder I wrote some years ago in C++, code which I am very
fond of -- it's pretty much the same code (as you'd expect) but my code is
decorated with a lot of noise surrounding error handling and memory
management/cleanup, as well as some unfortunate object oriented noise related
to general style of the project it had been written for.

------
shmerl
This is great, I'll get to it when it will be in a solid state. I'm also
waiting for some good high level chapters on Rust's approach to OOP and so on.

------
taliesinb
To anyone else who spots the switched around 'b' and 'c' on the repr(rust)
page: don't bother, I've already created a PR.

------
krallja
Seeing this book is what finally got me to go through The Rust Programming
Language.

