3 ms·
The author's main argument that it is okay for the standard library to be small is that you can pick an optimal(for you) implementation of functionality, and yo
by melissalobos 5y ago
The author's main argument that it is okay for the standard library to be small is that you can pick an optimal(for you) implementation of functionality, and you can check licenses of code easily with cargo, library authors prefer to have autonomy, and you can lock in dependencies to a specific version.
I feel like the main advantage of a large standard library is already vetted reasonable default code. When using python I don't need to read through a billion blog posts and forums to find a good json library. There is a decent one already in the standard library and it basically works. If I need a better one, then I would want to go searching. I think having a sensible default out of the box helps more than it hurts. For the compile times, why would cargo make you pay for what you don't use?
- nindalf 5y agoCompletely agree that the standard library is a sensible default. If a new user is wading through blog posts, something has definitely gone wrong. The hope is, the new user encounters the right resources. You mentioned json. If a user searches "rust read json", the top result is the best result - serde_json. Next is stackoverflow. All 5 answers from the Google results page mention the same - serde_json. After that, 3 blog posts about the same library. Sadly, it's only after that the Rust cookbook shows up. It recommends the same library, but it feels a bit low. Your point is valid in general though. If it's a more niche problem, finding the right library might not be obvious and users might give up.
- melissalobos 5y agoUsing the example of JSON, one of the issues in the Java ecosystem is that there are 3-5 JSON libraries(GJSON, Jackson, Org.json, Genson, etc.) that are commonly used. Today there is a clear choice for Rust, but in 5 years it will probably be more fractured. If you have one or more dependencies that also need to parse JSON, and they choose differently, you could have cargo building multiple JSON libraries and including parts of them in your application, which would increase the bloat of the resulting binary. This is of course a problem with any language and not Rust specific, but in an ideal world there would be one best way for doing most things included in the standard library and everyone would just use those.
- nindalf 5y agoWhat's funny is that serde pretty much dominates the serialisation space in Rust. It's as close to a de facto standard as possible. I would bet decent money that it remains the top lib in 5 years time. But your point stands - in an ideal world it would be nice if there was one obvious way to do it, and that obvious way was in the standard library.
- thesuperbigfrog 5y ago>> It's as close to a de facto standard as possible. Then why not put it in the standard library? If it is mature enough, then why not add it so anyone can use it without having to dowload it everytime? So that new users to Rust are not forced to search through all the possible candidates to find the best answer? If it is not ready, sure wait until it is or use something better. In the industry I work in, software needs to be mature, stable, and boring. I would love to start using Rust at work, but it is not ready in terms of maturity and stability because of reasons like these. Rust needs a standard. Rust needs multiple mature implementations. Rust needs a standard library that covers enough "everyday" use cases that you don't have to download half of crates.io to accomplish everyday tasks Perhaps it will be ready in 10 to 15 years. Until then, we will keep building things in C and C++.
- smt88 5y agoCounterpoint: maintaining an entire language is really hard and time-consuming. If you increase the surface area to a large stdlib, you're suddenly requiring core maintainers to spend a lot of time debugging libraries just to release a language version. Also consider that PHP, which has an astonishingly huge stdlib, still has native classes that handle SOAP requests that must be maintained for backwards compatibility.