4 ms·
Good job, guys! This is an exciting language. Really happy about the "native" language revival going on lately. I'm reading the docs, and they say that for I/O
by PopsiclePete 12y ago
Good job, guys! This is an exciting language. Really happy about the "native" language revival going on lately.
I'm reading the docs, and they say that for I/O, use the 'old_io' module, which is...deprecated?
If I were to start doing any I/O in Rust beta, would that code be essentially throw-away as soon as the 'new' io module lands?
- steveklabnik 12y agoThey should absolutely not say to use `old_io`, that must have slipped through. New IO has fully landed, you can't even use `old_io` in the beta. Which page? I'll fix it right now. :)
- PopsiclePete 12y agohttp://doc.rust-lang.org/nightly/std/index.html http://doc.rust-lang.org/nightly/std/index.html "Common types of I/O, including files, TCP, UDP, pipes, Unix domain sockets, timers, and process spawning, are defined in the old_io module." Following the "old_io" link leads me to http://doc.rust-lang.org/nightly/std/old_io/ http://doc.rust-lang.org/nightly/std/old_io/ which says "don't use me"
- steveklabnik 12y agoAh, thank you! We used to mention it from io's page, and I removed that, but this one slipped. https://github.com/rust-lang/rust/pull/24022 https://github.com/rust-lang/rust/pull/24022
- callahad 12y agoLooks like libstd/lib.rs still points to old_io, which shows up on http://doc.rust-lang.org/1.0.0-beta/std/ http://doc.rust-lang.org/1.0.0-beta/std/ Same with libcollections/fmt.rs defining the write! macro as taking an old_io::Writer There's also a bunch of old_io in http://doc.rust-lang.org/book/concurrency.html http://doc.rust-lang.org/book/concurrency.html
- steveklabnik 12y agoI just submitted a fix for the first, the second I'm not as sure about, and I just opened up https://github.com/rust-lang/rust/issues/24023 https://github.com/rust-lang/rust/issues/24023 for the third. It's non-trivial because Duration isn't yet stable, I thought it might be, so I didn't prioritize updating, but it didn't quite make it in. Thank you!
- callahad 12y agoShouldn't the third be trivial, since thread::sleep_ms takes a u32? Still building beta, but shouldn't this work? https://github.com/rust-lang/rust/pull/24024 https://github.com/rust-lang/rust/pull/24024
- steveklabnik 12y agoAhhh, so this was one of those last-hour changes, specifically so this works out, iirc. sleep will take a Duration, sleep_ms takes a u32. Anyway, let's keep talking in-ticket.
- nemo44x 12y agoThe doc's, and more specifically the tutorials, can be a bit stale. If you're referencing the one I think you are (building the number guessing game) it's old. I'm sure it will be updated eventually. [1] One of the hardest things about learning Rust right now is that because it is not 1.0, lots of the tutorials, sample code and 3rd-party documentation is outdated - or parts of it are. Learning Rust "the right way" will certainly get easier after 1.0 is finally out and reliable/stable the tutorials, code bases and doc's will follow. [1] I just checked and it is in fact updated.