News for hackers. Stuff that matters.
Re:Rust and the Future of Systems Programming [video] by steveklabnik on Wednesday November 16, 2016 @02:10PM (#12970307)
How are you trying? What are you getting stuck on? I'd love to improve things.
Re:Rust and the Future of Systems Programming [video] by q3r3qr3q on Wednesday November 16, 2016 @02:32PM (#12970581)
I'd get excited and go through some tutorial on their website, probably the main? tutorial, bu then when you get to the lifetimes section is seemed to get really complicated instantly. I tried twice and think I hit the same problem. Maybe some more good examples would help?
Re:Rust and the Future of Systems Programming [video] by steveklabnik on Wednesday November 16, 2016 @02:55PM (#12970844)
Makes sense! I'm working on a second draft of the book right now, and it's making that stuff more clear. http://rust-lang.github.io/book/ is the draft; the lifetimes bit hasn't landed yet though.
Re:Rust and the Future of Systems Programming [video] by rjammala on Thursday November 17, 2016 @04:05AM (#12975714)
Did you go through these screencasts?

http://intorust.com

Re:Rust and the Future of Systems Programming [video] by cbHXBY1D on Wednesday November 16, 2016 @02:32PM (#12970582)
Not specifically about your book, but I would love if there was a quicker way to find methods in the docs.

Right now, if I want to find the methods used by BTreeMap you have to wade through a good amount of information until you can find how to just get the keys. I'm currently on mobile where the issue is more prominent.

Re:Rust and the Future of Systems Programming [video] by steveklabnik on Wednesday November 16, 2016 @02:56PM (#12970851)
Are you missing the search bar at the top? Typing "keys" in shows BTreeMap's keys right away, even https://doc.rust-lang.org/stable/std/?search=keys

That said, yeah, I hear you. It can still be tough sometimes. At some point, I'd love to work with some sort of information design / UX person to totally re-do rustdoc's output. There's a surprising number of thorny problems there. But there's always so much to do...

Re:Rust and the Future of Systems Programming [video] by nnethercote on Wednesday November 16, 2016 @03:54PM (#12971407)
If you click the "[-]" symbol at the top right of a docs page it collapses all the text and just shows the method signatures. Then you can click the "[+]" symbol next to any single method to get full details.
Re:Rust and the Future of Systems Programming [video] by wyldfire on Wednesday November 16, 2016 @02:52PM (#12970805)
If I don't find what I'm looking for from the docs, I often use ripgrep on a copy of the rust repo locally to find answers.
Re:Rust and the Future of Systems Programming [video] by travv0 on Wednesday November 16, 2016 @03:42PM (#12971300)
> I often use ripgrep on a copy of the rust repo locally to find answers

I mean, that works, but it's a workaround and not a solution.

Re:Rust and the Future of Systems Programming [video] by papaf on Wednesday November 16, 2016 @04:34PM (#12971785)
What are you getting stuck on? I'd love to improve things.

I feel I am getting over the hump of learning rust now and coding in rust is becoming less frustrating for me.

However, one thing that slows me down is the lack of indices in the documentation. For instance, if I want to know the return type of a vector len() I go here:

https://doc.rust-lang.org/std/vec/struct.Vec.html

.. and then I have to search the web page for all instances of "len". It would be good if there was an index similar to Javadoc, Godoc or Doxygen.

There might be a good reason for not having the index, but as a beginner it is lost on me.

Re:Rust and the Future of Systems Programming [video] by steveklabnik on Wednesday November 16, 2016 @04:42PM (#12971852)
Two things:

If you click the little [-] button, you'll get an index for that page.

If you use the search bar at the top, https://doc.rust-lang.org/std/vec/struct.Vec.html?search=vec... will let you go right to the method. (In this case, you have to know that it's slice::len though)

Does that help?

EDIT: UX is hard! Glad people are discovering this. It's the same symbol HN uses, incidentally...

Re:Rust and the Future of Systems Programming [video] by jean- on Wednesday November 16, 2016 @05:30PM (#12972221)
Whoa, I have been working with Rust for a little over a year, and had no idea about the [-] button.

I would echo the suggestions to make that button much more visible. Or perhaps even have the top-level description expanded by default but method/trait descriptions hidden. I can't think of a case where you'd simultaneously want to see every method description.

Re:Rust and the Future of Systems Programming [video] by staticassertion on Wednesday November 16, 2016 @05:31PM (#12972229)
Been using rust for months now and I never knew the [-] did that. I never even thought to click it.

Seems like there's some UX improvements that could happen there.

Re:Rust and the Future of Systems Programming [video] by papaf on Wednesday November 16, 2016 @05:02PM (#12971992)
Thanks, thats very helpful. I did not know about the minus sign.

A polite suggestion - maybe the link marked [-], that takes you to the index, could be labelled "index".

Re:Rust and the Future of Systems Programming [video] by steveklabnik on Wednesday November 16, 2016 @05:23PM (#12972164)
Well, it's not so much that it's an index, it's that when you have a page with only signatures, it feels like an index. There's no redirect, just some JavaScript :)
Re:Rust and the Future of Systems Programming [video] by phaylon on Wednesday November 16, 2016 @06:10PM (#12972491)
Maybe 'collapse' and 'expand' would be good substitutes for the '-' and '+' at the top?
Re:Rust and the Future of Systems Programming [video] by lacampbell on Wednesday November 16, 2016 @03:32PM (#12971188)
Not OP, but as someone who theoretically would like Rust - I'll bite. Maybe my usecase is a common one.

I understand memory management in C. I understand it modern C++ (destruction when going out of scope, smart pointers etc).

Basically, a description and discussion of borrow-checking for people who have already used system programming languages would be really helpful. I feel like the book is targeting people who have only used garbage collected languages.

Or is the memory management of rust so novel it can't be described in those terms? I find the concepts aren't very concrete to me.

Re:Rust and the Future of Systems Programming [video] by steveklabnik on Wednesday November 16, 2016 @04:10PM (#12971559)
It's trying to be accessible to those people, but not strictly for them. I don't think the issue here is that it's for GC'd users, but that it's trying to explain things from whole-cloth, where you're looking for a direct comparison, "c does this, rust does that."

I try generally to keep other languages out of Rust's docs for various reasons, but agree that these kinds of resources are useful; I wrote "Rust for Rubyists" after all!

I'm hoping that others will step in and fill this gap; the repo in my sibling is a great start.

Re:Rust and the Future of Systems Programming [video] by fuine on Wednesday November 16, 2016 @04:01PM (#12971476)
Have you tried looking at https://github.com/nrc/r4cppp ?
Re:Rust and the Future of Systems Programming [video] by lacampbell on Wednesday November 16, 2016 @04:48PM (#12971894)
That looks like exactly what I'm after actually. I'll read this next time I try rust.
Re:Rust and the Future of Systems Programming [video] by shriek on Wednesday November 16, 2016 @03:05PM (#12970939)
I'm also in a similar boat but my primary thing being that I learn by doing and since it's branded as "system programming" I immediately think of big projects like kernels and drivers. I wish there were some small projects that I could do apart from just doing "project euler" that would be helpful to me. I even bought raspberry pi to learn rust but don't quite know what to do with it and rust.
Re:Rust and the Future of Systems Programming [video] by nostrademons on Wednesday November 16, 2016 @04:20PM (#12971651)
There are a large number of projects on Cargo that maybe-perhaps do something useful, but don't get much love in the testing/documentation/polish department since the authors tend to move onto other projects. My personal wish list:

Varints: https://crates.io/crates/varint

Bloom filters: https://crates.io/crates/bloom

Iron: https://github.com/iron/iron

All the accessories for Iron: authentication middleware, integration with OAuth2, cookie-signing, integration with templating systems, etc. Also, an omakase framework (like Django or Rails) that pulls together a bunch of useful libraries into one crate that you can just use (with good docs) and not have to wire everything up.

Websockets: https://github.com/cyderize/rust-websocket or https://github.com/housleyjk/ws-rs

Server-sent events. I don't see a good alternative for these yet.

ElasticSearch: https://github.com/benashford/rs-es or https://github.com/erickt/rust-elasticsearch or https://github.com/KodrAus/elasticsearch-rs

An easy documentation/website generator for small libraries, that pulls examples, tests, and README files out of GitHub, runs RustDoc, and generates a professional-looking website that provides all the info that you need to get started with a library, with a minimum of extra effort for the library author. Basically, automate the job of going through libraries built to scratch someone's personal itch and "productizing" them.

Any of these could be a good project for a beginner, since there's already a lot of existing code to learn from, a small well-defined task, and an existing maintainer who has an incentive to help. Basically, just take a library, try to use it in a small test program (Linus's Law: "Never try to make a big important program. Always start with a small trivial program, and work on improving it"), and if anything is difficult or doesn't work right, figure out how to make it less difficult for the next person who runs across it and submit a pull request with that. As an added bonus, you can learn a lot of domain knowledge or basic CS data structures through digging through this, and that transfers to programming outside of Rust.

Re:Rust and the Future of Systems Programming [video] by bquinlan on Wednesday November 16, 2016 @04:39PM (#12971826)
This might be too much like Project Euler but I started by solving some common interview problems using Rust.

Try solving the problems without looking at the solutions first: https://github.com/brianquinlan/learn-rust

Here is a rough rank of difficultly: https://github.com/brianquinlan/learn-rust#understandability

Re:Rust and the Future of Systems Programming [video] by steveklabnik on Wednesday November 16, 2016 @03:20PM (#12971078)
Makes sense! Have you seen http://www.chriskrycho.com/2016/using-rust-for-scripting.htm... ? Maybe something like that can be of inspiration.