On 10/23/13 9:43 AM, Diggory Hardy wrote:
     use std::rt::io::File;

     let mut stream = File::create("test.txt");
     writeln!(&mut stream, "test {}, {}, {aa}", 1, 3.0, aa=2);


Which I think looks a lot better than before! I would love to not have
to write `&mut stream` or have something like `stream.write!(foo, bar,
baz)`, but I haven't thought much about changing the write! macro.

Are macros possible in traits?

stream.writeln!( "test {}, {}, {aa}", 1, 3.0, aa=2 );

That can't really be done due to a phasing problem: macros run before typechecking, but trait resolution is not done until typechecking (and monomorphization happens at codegen, which actually can occur *after* compilation due to libraries).

Patrick

_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to