3 ms·
Small binaries has nothing to do with the reason for that. Build tools will only include what's needed either way, so e.g. your Hello World program will have pa
by hobofan 3y ago
Small binaries has nothing to do with the reason for that. Build tools will only include what's needed either way, so e.g. your Hello World program will have parts of std::io and std::fmt, and not really anything beyond that. So you "pay for what you use", regardless of whether it's part of the standard library or an external library.
I think in Rust the choice is more one that originally prioritized viability of long-term maintenance of the project by keeping the volume and surface of the standard library small. For all more recent inclusion the inclusion criteria seem to be either "small ecosystem functionality that everybody is using and has proven to be valuable" (e.g. once_cell) or "what is close-to-optimal solution for critical parts of the ecosystem that we have to include to minimize ecosystem splintering" (e.g. the work around std::future). I wouldn't be surprised if there are actual written down criteria for std inclusion somewhere.
- steveklabnik 3y ago> I wouldn't be surprised if there are actual written down criteria for std inclusion somewhere. I’m not aware of the current state, but in the old days, it was roughly: 1. Is this useful in virtually every Rust program? 2. Is this something (data structures, mostly) that requires a lot of unsafe to implement? 3. Is this a vocabulary type? Any of these is a slam dunk, anything else is more subjective.
- coldtea 3y ago>1. Is this useful in virtually every Rust program? That's too strict a criterion for a standard library!
- steveklabnik 3y agoSure, different people can have different opinions. But it’s also not literally true, in the sense that it’s only one of three criteria, but also because it’s more of a conceptual framing than something to be taken exactly. There’s just a high bar of usefulness required. You can tell that this isn’t literally true just by looking at the contents of the standard library.