Skip to content

Libcore: move "io" to libcore #1373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kud1ing opened this issue Dec 22, 2011 · 5 comments
Closed

Libcore: move "io" to libcore #1373

kud1ing opened this issue Dec 22, 2011 · 5 comments

Comments

@kud1ing
Copy link

kud1ing commented Dec 22, 2011

In libcore-land we we can perform calculations and string operations, but we need to discard them eventually, because there are no means to exchange them with the world.

Please move the module "io" to libcore.

@kud1ing
Copy link
Author

kud1ing commented Dec 22, 2011

Once this is moved, we should re-export some "io"-function in "core.rs"
"print", "println" come to mind.

@marijnh
Copy link
Contributor

marijnh commented Dec 22, 2011

I disagree. There are various approaches to doing I/O, and hard-wiring one into the core library is probably now what we want.

@kud1ing
Copy link
Author

kud1ing commented Dec 22, 2011

As i understood #1096, one goal of libcore was to provide a prelude so that you can write

fn main() {
   println("hello world");
}

instead of

import std::io;
fn main() {
  io::println("hello world");
}

My assumption is that in the end you are going to do any kind of filehandle based I/O in any case.
Even a pure network-client/-server needs to write to a logfile or to STDERR.

If my assumption is correct, and we don't move "io" to libcore, libcore would never be used without libstd.
So why have libcore at all?

@kud1ing kud1ing closed this as completed Dec 22, 2011
@kud1ing kud1ing reopened this Dec 22, 2011
@graydon
Copy link
Contributor

graydon commented Dec 23, 2011

I am in favour of io:: in libcore. We may tweak the interface, and/or add a richer aio one (either in core or std), but that's true of any module we're considering.

I think at least simple, stdio-style synchronous IO is fair by the third (and possibly second) criteria for libcore. Just about every nontrivial program does IO. It's part of the interface exposed by even the narrowest posix-y narrowings of libc's surface, and we even expose bits through our runtime. I think it's appropriate.

@boggle
Copy link
Contributor

boggle commented Dec 25, 2011

I would not go beyond having stdio support and required generic interfaces in core to keep in line with our goal of keeping it small. I could also quite live with keeping io in its own lib atop core but separate from the rest of std if both should turn out big enough to justify this.

An argument against having io in core would be the availability of the log statement which really is enough to get going with any minimal software that only depends on core.

@ghost ghost assigned graydon Jan 31, 2012
@graydon graydon closed this as completed Mar 12, 2012
graydon added a commit to graydon/rust that referenced this issue Mar 13, 2012
…lang#1638.

 - Move io, run and rand to core.
 - Remove incorrect ctypes module (use libc).
 - Remove os-specific modules for os and fs.
 - Split fs between core::path and core::os.
bjorn3 added a commit to bjorn3/rust that referenced this issue Jun 15, 2023
Benchmark clif release builds with ./y.rs bench
Kobzol pushed a commit to Kobzol/rust that referenced this issue Dec 30, 2024
bors pushed a commit to rust-lang-ci/rust that referenced this issue Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants