| ▲ | wongarsu 6 hours ago |
| I wouldn't call the Rust stdlib "small". "Limited" I could agree with. On the topics it does cover, Rust's stdlib offers a lot. At least on the same level as Python, at times surpassing it. But because the stdlib isn't versioned it stays away from everything that isn't considered "settled", especially in matters where the best interface isn't clear yet. So no http library, no date handling, no helpers for writing macros, etc. You can absolutely write pretty substantial zero-dependency rust if you stay away from the network and async Whether that's a good tradeoff is an open question. None of the options look really great |
|
| ▲ | WD-42 3 hours ago | parent | next [-] |
| Rand, uuid, and no built in logging implementation are three examples that require crates but probably shouldn’t. |
| |
|
| ▲ | ghurtado 9 minutes ago | parent | prev | next [-] |
| > if you stay away from the network and async That's some "small print" right there. |
|
| ▲ | SAI_Peregrinus 2 hours ago | parent | prev | next [-] |
| > But because the stdlib isn't versioned I honestly feel like that's one of Rust's biggest failings. In my ideal world libstd would be versioned, and done in such a way that different dependencies could call different versions of libstd, and all (sound/secure) versions would always be provided. E.g. reserve the "std" module prefix (and "core", and "alloc"), have `cargo new` default to adding the current std version in `cargo.toml`, have the prelude import that current std version, and make the module name explicitly versioned a la `std1::fs::File`, `std2::fs::File`. Then you'd be able to type `use std1::fs::File` like normal, but if you wanted a different version you could explicitly qualify it or add a different `use` statement. And older libraries would be using older versions, so no conflicts. |
| |
| ▲ | Zettroke 2 hours ago | parent [-] | | I'm afraid it won't work. The point of std lib is to be universal connection for all the libraries. But with versioned std I just can't see how can you have DateTime in std1, DateTime in std2 and use them interchangeably, for example being able to pass std2::DateTime to library depending on std1 etc. Maybe conversion methods, but it get really complicated really quickly |
|
|
| ▲ | galangalalgol 5 hours ago | parent | prev | next [-] |
| Network without async works fine in std. However, rand, serde, and num_traits always seem to be present. Not sure why clap isn't std at this point. |
| |
| ▲ | wongarsu 4 hours ago | parent | next [-] | | Clap went through some major redesigns with the 4.0 release just three years ago. That wouldn't have been possible if clap 2.0 or 3.0 had been added to the stdlib. It's almost a poster child for things where libraries where being outside the stdlib allows interface improvements (date/time handling would be the other obvious example). Rand has the issue of platform support for securely seeding a secure rng, and having just an unsecure rng might cause people to use it when they really shouldn't. And serde is near-universal but has some very vocal opponents because it's such a heavy library. I have however often wished that num_traits would be in the stdlib, it really feels like something that belongs in there. | | | |
| ▲ | TheDong 3 hours ago | parent | prev | next [-] | | > Not sure why clap isn't std at this point. The std has stability promises, so it's prudent to not add things prematurely. Go has the official "flag" package as part of the stdlib, and it's so absolutely terrible that everyone uses pflag, cobra, or urfave/cli instead. Go's stdlib is a wonderful example of why you shouldn't add things willy-nilly to the stdlib since it's full of weird warts and things you simply shouldn't use. | | |
| ▲ | geodel 2 hours ago | parent | next [-] | | > and it's so absolutely terrible that everyone uses pflag, ../ This is just social media speak for inconvenient in some cases. I have used flag package in lot of applications. It gets job done and I have had no problem with it. > since it's full of weird warts and things you simply shouldn't use. The only software that does not have problem is thats not written yet. This is the standard one should follow then. | |
| ▲ | poly2it 2 hours ago | parent | prev [-] | | Go is also famous for encouraging a culture of keeping down dependency count while exposing a simple to use package manager and ecosystem. | | |
| |
| ▲ | Ygg2 5 hours ago | parent | prev [-] | | > why clap isn't std at this point. Too big for many cases, there is also a lot of discussion around whether to use clap, or something smaller. |
|
|
| ▲ | atherton94027 2 hours ago | parent | prev | next [-] |
| > On the topics it does cover, Rust's stdlib offers a lot. At least on the same level as Python, at times surpassing it. Curious, do you have specific examples of that? |
|
| ▲ | 6 hours ago | parent | prev [-] |
| [deleted] |