Re: [rust-dev] writing file

2013-10-24 Thread Alex Bradbury
On 24 October 2013 01:01, Alex Crichton a...@crichton.co wrote: We're entertaining the idea of removing conditions, so the `writeln!` macro and related `write!` functions will probably all return a `Result(), ~Error` or whatever the generic error type becomes. Just from the IO module, or the

Re: [rust-dev] writing file

2013-10-24 Thread Steve Klabnik
Conditions don't require language support, IIRC, they're just a library. So even if they were totally removed, you could still use them. ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev

Re: [rust-dev] writing file

2013-10-23 Thread Alex Crichton
Right now the file I/O isn't quite what I think we want it to be in the end, but otherwise that is roughly the code which you'll want to write. It could be slightly shortened like this: use std::rt::io::Writer; use std::rt::io::file::FileInfo; use std::rt::io; let mut stream =

Re: [rust-dev] writing file

2013-10-23 Thread Diggory Hardy
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

Re: [rust-dev] writing file

2013-10-23 Thread Ziad Hatahet
On Wed, Oct 23, 2013 at 8:47 AM, Alex Crichton a...@crichton.co wrote: With these changes, the code would look like: use std::rt::io::File; let mut stream = File::create(test.txt); writeln!(mut stream, test {}, {}, {aa}, 1, 3.0, aa=2); How would errors be handled in this

Re: [rust-dev] writing file

2013-10-23 Thread Alex Crichton
Are macros possible in traits? Right now the grammar does not allow for this, and it may be difficult to do so (I don't think that we're going to change that in the near future) Object coercion would be great, is that a planned feature? I believe so. I thought there was a bug open already,

Re: [rust-dev] writing file

2013-10-23 Thread Patrick Walton
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