[rust-dev] Can macro use variable values?

2014-09-17 Thread Daneel Yaitskov
Hi, Does Rust macro have flow control based on a variable value? I didn't find such info here http://doc.rust-lang.org/guide-macros.html. I'd like to get a macro expading a for loop. doTimes(3, println!()) = println!() println!() println!() -- Daneel S. Yaitskov

[rust-dev] Bug in the guide?

2014-09-17 Thread Pablo Brasero Moreno
Hello all. I just subscribed to this list only because I found something odd on the Rust Guide, and couldn't find a better place to send feedback. It's about section 13 Standard Input. The first example code is the following: use std::io; fn main() { println!(Type something!);

Re: [rust-dev] Bug in the guide?

2014-09-17 Thread Steve Klabnik
Yup, that leading std:: in main shouldn't be there. ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev

Re: [rust-dev] Bug in the guide?

2014-09-17 Thread Tim Joseph Dumol
Hi Pablo, You can submit a pull request at the Rust Github repo ( https://github.com/rust-lang/rust). The relevant file is at `/src/doc/ guide.md`: https://github.com/rust-lang/rust/blob/master/src/doc/guide.md. Cheers, Tim Dumol On Thu, Sep 18, 2014 at 3:55 AM, Steve Klabnik

Re: [rust-dev] Bug in the guide?

2014-09-17 Thread Pablo Brasero Moreno
Rust community living up to its fame of awesomeness! Thanks for that. The pull request is already on the queue. On 17 September 2014 20:58, Tim Joseph Dumol t...@timdumol.com wrote: Hi Pablo, You can submit a pull request at the Rust Github repo ( https://github.com/rust-lang/rust). The

Re: [rust-dev] std::rand::Rng

2014-09-17 Thread Evan Davis
The problem is that you're trying to use a trait as a type. This code works for me ``` use std::rand::{Rng, task_rng}; fn main() { let rng = mut task_rng(); print_numbers(rng); } fn print_numbersT:Rng(r: mut T) { for _ in range(0u, 10) { println!({}, r.gen::uint()); } }

Re: [rust-dev] std::rand::Rng

2014-09-17 Thread Sean McArthur
On Wed, Sep 17, 2014 at 2:26 PM, Evan Davis cptr...@gmail.com wrote: The problem is that you're trying to use a trait as a type. That shouldn't be a problem. You can use a `mut Trait`, and you'll get dynamic dispatch. ___ Rust-dev mailing list