News for hackers. Stuff that matters.
Re:Rust by Example by killercup on Monday May 09, 2016 @04:26AM (#11658288)
If you want something like this but a little bit shorter that easily fits on 3 printed pages: https://learnxinyminutes.com/docs/rust/
Re:Rust by Example by sitkack on Monday May 09, 2016 @11:36AM (#11660599)
And https://play.rust-lang.org/ can be used to test snippets of Rust code w/o having to install compiler. The best feature is you can make a link to your code for others to review.
Re:Rust by Example by sambe on Monday May 09, 2016 @03:32AM (#11658140)
I found this to be okay as a relatively speedy intro. It's quite disorganised though - some concepts and terms appear to be assumed but then introduced properly later on. I was wondering if this was intentional or not (maybe you are supposed to be patient?).
Re:Rust by Example by halomru on Monday May 09, 2016 @06:57AM (#11658823)
I assume the site is mostly aimed at people who have already read the rust book [1].

[1] https://doc.rust-lang.org/book/

Re:Rust by Example by brinker on Monday May 09, 2016 @08:43AM (#11659336)
Rust by Example was actually not originally a Rust team project. It was an independent work that was handed over to the Rust team for maintenance by the original author.

As I understand, it received basic polishing and updates to make sure it was correct, but hasn't been edited much beyond that.

Re:Rust by Example by steveklabnik on Monday May 09, 2016 @11:24AM (#11660506)
This history is accurate. RBE is pretty low on my priority list; finishing up the book and the standard library docs are much more important right now. I to try to keep up on PRs.
Re:Rust by Example by jug on Monday May 09, 2016 @10:10AM (#11659950)
Hmm, this is a bit confusing as the book is also quite terse for being a book teaching about a new language, and also heavily example based.
Re:Rust by Example by mdcox on Monday May 09, 2016 @06:17AM (#11658668)
Not sure of the original intent, but when I started using Rust I used Rust By Example for finding snippets of things like file io where I get the gist but want to quickly see the pattern or involved parts of the stdlib.

The Rust docs are great, but having a starting point can be super welcoming so you aren't poking around blindly at different types that might be relevant.

Re:Rust by Example by robmccoll on Monday May 09, 2016 @08:36AM (#11659288)
Yeah it's more of a well-connected graph than a tree. Most of the examples that contain a concept that hasn't been covered include a link to where it is covered, and generally completely understanding the details in the example may help improve your understanding of the concept being introduced but isn't necessary to get a basic grasp.
Re:Rust by Example by steveklabnik on Monday May 09, 2016 @11:22AM (#11660486)
We've had a contributor that's been slowly going through the text on a variety of things, and they're also working on untangling forward references.
Re:Rust by Example by Twirrim on Monday May 09, 2016 @09:59AM (#11659857)
What's with the exclamation mark at the end of function names? e.g. println!("foo")
Re:Rust by Example by cfallin on Monday May 09, 2016 @10:01AM (#11659887)
That signifies a macro. It's meant to visually distinguish macros from ordinary function calls because macros may have arbitrary semantics (they can expand into any code at all). The stdlib defines `println` as a macro because it allows for a neat compile-time parsing of format strings.

(See [1] and the linked source if curious.)

[1] https://doc.rust-lang.org/std/macro.println!.html

Re:Rust by Example by Grue3 on Monday May 09, 2016 @01:03PM (#11661337)
Sounds like what Rust needs is compile macros [1]. That way, printf can still be a function, but it would be optimized at compile time if the formatting string is constant.

[1] https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node101.html

Re:Rust by Example by akjj on Monday May 09, 2016 @01:38PM (#11661595)
Compile macros wouldn't be sufficient for Rust's println! because the type signature (even the number of arguments) depends on the format string. The format string has to be constant and has to be interpreted at compile time so that the variables being printed can be type-checked.
Re:Rust by Example by Twirrim on Monday May 09, 2016 @12:44PM (#11661170)
Thanks, that makes a lot of sense as a design decision, should be a big step forwards for security.
Re:Rust by Example by sig_chld_mike on Monday May 09, 2016 @08:27AM (#11659229)
no table of contents? see the gobyexample.com site for how to do it better
Re:Rust by Example by robmccoll on Monday May 09, 2016 @08:32AM (#11659259)
Are you on mobile? I get a hamburger menu at the top that pulls out a ToC from the left side.
Re:Rust by Example by blub on Monday May 09, 2016 @09:10AM (#11659517)
Nothing appears on iOS with content blockers on, but the menu is still clickable. Another brilliant example of modern web-design.
Re:Rust by Example by whateveracct on Monday May 09, 2016 @10:41AM (#11660167)
Did you scroll a little bit? It's not visible unless you scroll up.
Re:Rust by Example by sitkack on Monday May 09, 2016 @11:38AM (#11660607)
The example are meant to be edited and re-executed, a desktop would provide a better experience.