353 points · by ingve · 7y ago · 62 comments
Because Rust's type system is so good, auto-generated function signatures are actually pretty useful. However this is one area in which the language is clearly immature.
While a large set of libraries is helpful, I wouldn't let that stop you if you think Rust is a good fit for your problem.
Obviously, these tools don't solve the problem for you. In the same way that some C++ projects use doxygen without writing doc comments and say "but we have auto-docs!", some Rust projects (the rust compiler libraries and official projects, e.g., cargo, libsyntax, etc.) almost completely lack API docs. They do have books (rustc book and implementors guide, cargo book, etc.) so it isn't that they are completely undocumented, but if you want to use these as libraries, the auto-generated API docs are useless.
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGui...
It's more about how many concepts you need to be aware of to write something. Garbage collection is a complex topic you can ignore at first, for example. Rust pointer management takes immediate investment. Even freeing pointers you can be lazy about at first. Rust makes it easier to write good code at the cost of making it hard to write bad code.
It can also be painlessly integrated into Node.js programs as native modules and interoperability makes a Rust + Node combo a perfect mix for many use cases.
There are some very well solved problems and I don’t think Rust should hide the fact that you can also rely on those. The idea of a cookbook is to solve common problems — and sometimes the easier way to do this is to use an battletested external dependency.
In Python it is often said that stdlib is where modules go to die, and dependency management in Rust is a particularly different experience to most other languages. A good example of why keeping the standard library lean can be a good idea in the long term would be datetime handling in Java: https://stackoverflow.com/questions/12032051/differences-bet...
We can’t just take control of a project just because it’s popular, that’s not really how open source works.
A similar resource that focuses more on the language and standard library is Rust by Example:
If you need something simpler than the community's choice and don't want a dependency, roll your own. Otherwise, the ecosystem has you covered.
I will admit that I don't understand why Random is its own crate, and not in the standard library, however...
Cargo, the package management system is very good, and the resulting binary is compiled (therefore you aren’t thrusting 3rd party dependencies on your end users), so there is far less incentive to avoid 3rd party libraries than there might be in Python for example.
Can you parse CLI arguments manually using rust? Of course, but should you?
I see that it starts with random numbers, but when I was learning I got tripped up a bit when trying to generate seeded randoms.
It might take some time to respond to, because this project got really far but not quite across the finish line, and I think the main maintainer has dropped out. We’ll get to it...
See e.g. [1] for a possible approach.
Once its sorted, I think comparing and contrasting this kind of thing would be amazing though.