News for hackers. Stuff that matters.
Re:Rust Cookbook by bibyte on Sunday March 17, 2019 @01:59PM (#19415315)
Another great book that is completely free and open source. Rust might be a little harder to learn then other languages but you can't deny that it has great resources if you decide to learn it.
Re:Rust Cookbook by whatshisface on Sunday March 17, 2019 @02:37PM (#19415550)
The Rust documentation is deep but not wide: unlike Python (for example) the standard library is small, which means that the well-documented area is small. Almost as soon as you try to get anything done, you will end up reading auto-generated function signature docs and browsing through the source code of whatever crate you want to use. This is true for scientific computing and game libraries, and may not be true for networking which I hear is very well-developed.

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.

Re:Rust Cookbook by melling on Sunday March 17, 2019 @02:47PM (#19415608)
That's what Perl programmers used to say about Python. It couldn't compete with the CPAN library.

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.

Re:Rust Cookbook by dnautics on Sunday March 17, 2019 @03:19PM (#19415885)
To be honest, python libraries are wide but the documentation quality isn't always the best (I could be spoiled)
Re:Rust Cookbook by cpach on Sunday March 17, 2019 @05:03PM (#19416578)
”documentation quality isn't always the best”

Compared to what? (Asking just out of curiosity.)

Re:Rust Cookbook by 4thaccount on Sunday March 17, 2019 @05:10PM (#19416641)
In general, I find Perl's CPAN to usually have really good documentation that surpasses what Python has, even though I prefer Python over Perl nine times out of ten.
Re:Rust Cookbook by kbenson on Sunday March 17, 2019 @09:28PM (#19418016)
As a full time Perl developer, I've wondered more than once if this is due to the way the way the language shapes the community. Perl has evolved (out of necessity) a very strong level of norms and best practices that users are aware of, and put effort into following (well, most the time, Perl is all about letting you pull out the shiny weirdness and letting it shine where it fits well). Module documentation is part of this. A module could implement an object oriented interface, a procedural interface, both, import function into the main scope on use, or on request, or any number of weird (and depending on your point of view wonderful) things.

Not having good documentation means nobody knows how to use your module without a lot of work reading the code. So modules get documented or they get ignored. Thus, the modules on CPAN you know about and that are commonly used and relied on by other modules are the ones that have good documentation. It's self reinforcing. I imagine in a language that funnels use into a single or small set of idiomatic ways to accomplish most tasks, it might be easier to skimp on documentation and rely on people to fall back on the "obvious" way to things.

Re:Rust Cookbook by 4thaccount on Sunday March 17, 2019 @09:39PM (#19418073)
I'm not a full-time Perl Dev like you, but do whip up something a few times a year and it is there when I need it. I'm therefore incapable of properly replying to your thoughts although it makes sense to me (Perl is so flexible that you better have good documentation if you make a module and want it used). My thoughts are more along the lines of how much modules and CPAN are pushed in general. Most of my Perl books (Ovid's in particular) go into excruciating detail on publishing packages. It's not a two pager crammed into an appendix either, but is front and center. The Perl community frequently hosts challenges to clean up old modules and such. There is even a guy with the last name of "Anwar" if I recall correctly that is a celebrity in the community for how many modules he maintains that aren't even his (and he has also done challenges like making a new pull-request every day for like a year). That is some real dedication there to making Perl useful. It is one of the things I really like about the community. I'm a little bit of a language hobbyist even though I'm still only a novice coder in my mind. Out of all the languages that I've spent time with (probably 2 dozen) learning superficially, I'd say Perl ranks towards the top of the spectrum when it comes to focusing on this. They've evolved a relatively simple and effective system for allowing users to make, share, and document libraries.
Re:Rust Cookbook by kbenson on Sunday March 17, 2019 @10:01PM (#19418170)
> They've evolved a relatively simple and effective system for allowing users to make, share, and document libraries.

Well, as is often said, simple is not easy. :) There's a large effort by the CPAN testers community to run every module (and every new version of it) against a large array of hardware and operating systems[1], and provide automated reporting to the author of any problems.

This is possible because of (and incentivizes) the other great aspect of CPAN and the public modules which are on it, which is a strong culture of good test coverage of modules, and the CPAN clients running all tests and failing to install by default if any tests fail that weren't expected to. It's another wonderful feedback loop, and one not encouraged or discouraged by most languages specifically, so the fact that so many package managers for languages decided not to do so is unfortunate. When you don't start with that as an expectation, turning it on at a later date likely just results in a horrible user experience as a large number of module just fail to install (or at a minimum spew warnings which are confusing) because they are exposing what was previously something only the author saw most the time.

1: http://matrix.cpantesters.org/?dist=Path-Tiny+0.104

Re:Rust Cookbook by 4thaccount on Sunday March 17, 2019 @10:15PM (#19418233)
Thanks for the helpful replies. I didn't know that.
Re:Rust Cookbook by dnautics on Monday March 18, 2019 @02:49AM (#19419128)
Check out docs for elixir. It's a community where the standard library docs set a high standard of quality that quite a few package developers seem inclined to try to aim for. Heck, the documentation for the Float module even is kind enough to warn you about gotchas in IEEE floating point.

https://hexdocs.pm/elixir/Kernel.html

One thing I really like: Unlike in python docs, on all the function calls and most module headings you can click through to the actual elixir source code and see how the functions work under the hood (via the <\> link). You also get this nearly for free when doing docgen on your own modules (it's one line in setup). Also, the HTML is responsive so it's easy to review your own code when on the toilet, if necessary.

And there are python libraries that are horrible offenders. Perhaps it's a matter of taste or experience, but I found the tensor flow docs to be inscrutable and nearly useless

Re:Rust Cookbook by dan-robertson on Monday March 18, 2019 @03:40AM (#19419291)
I’ve found latex packages often have quite good documentation. Sometimes elisp packages have good documentation but sometimes they don’t.
Re:Rust Cookbook by est31 on Monday March 18, 2019 @06:24AM (#19419944)
Rust at least has auto-generated documentation. Python lacks that. Some python libraries might have documentation up, but there's no docs.rs like thing where you can just find docs for (almost) every library available.
Re:Rust Cookbook by floofy222 on Monday March 18, 2019 @07:13AM (#19420144)
I feel that the quality of auto-generated docs is generally better for Rust than for other languages like C++ (e.g. via doxygen). This is because the tools make it trival to publish and distribute docs for your crate, and people make use of that because it is so easy.

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.

Re:Rust Cookbook by steveklabnik on Sunday March 17, 2019 @02:49PM (#19415624)
We’ve been trying to figure out how to improve this, but it’s tough.
Re:Rust Cookbook by Twirrim on Sunday March 17, 2019 @05:33PM (#19416775)
Feels like solving a cultural problem.. but one that affects a large part of the software development community. The aversion to writing documentation seems pretty deep set in most developers :)
Re:Rust Cookbook by dodobirdlord on Monday March 18, 2019 @01:16AM (#19418835)
Perhaps I'm missing something obvious, but cannot a large part of this be addressed by significantly expanding the standard library? A favorite feature of mine in AWS CloudFormation is the ability when writing Lambda functions for the Python runtime to inline the code into the template and sidestep the process of generating and uploading code artifacts. This works because other than the (provided) boto3 SDK, I generally need nothing but the standard library.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGui...

Re:Rust Cookbook by dan-robertson on Monday March 18, 2019 @03:45AM (#19419307)
Putting things in the standard library can greatly slow down their development as it upgrades when the standard library does and deprecating things can be more painful for library users because it is much easier to choose an older version of some boring library than of the standard library.

Then again, maybe one would want such things to slow down development

Re:Rust Cookbook by turbinerneiter on Monday March 18, 2019 @04:57AM (#19419549)
There is probably a _right time_ to start pulling more libraries into the standard library.
Re:Rust Cookbook by steveklabnik on Monday March 18, 2019 @10:23AM (#19421226)
That comes with all of the downsides of significantly expanding the standard library.
Re:Rust Cookbook by adamnemecek on Sunday March 17, 2019 @02:16PM (#19415400)
I wouldn’t say harder, like learning c++ well (patterns + concurrency etc) is legit hard. Same for other languages. Rust has surprisingly few concepts, it’s just that they combine nicely.
Re:Rust Cookbook by jayd16 on Sunday March 17, 2019 @03:37PM (#19416013)
It's harder like people think static typing is hard.

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.

Re:Rust Cookbook by mjw1007 on Sunday March 17, 2019 @02:35PM (#19415538)
I find myself able to deny that it has great resources. The reference manual is very weak.
Re:Rust Cookbook by steveklabnik on Sunday March 17, 2019 @02:48PM (#19415620)
It’s going to be a big area of work this year!
Re:Rust Cookbook by jake_the_third on Sunday March 17, 2019 @11:56PM (#19418591)
This is really good news. Hopefully a more well-developed and thorough reference will allow for a GCC rust frontend to be developed.
Re:Rust Cookbook by steveklabnik on Monday March 18, 2019 @12:39PM (#19422633)
I don't think that that's really the blocker there, afterall, mrustc exists. That said, maybe it will give someone enough confidence to step up and do the work, I dunno. We'll see!