Hacker News new | ask | show | jobs
by sakex 566 days ago
I agree to some extent, but I'd say it depends on the programming language. For instance, in Python, you absolutely need documentation because you don't know what type is expected, what different values can be passed or even the optional kwargs etc. It's also very common to pass strings as parameters when one should be using enums, which means you can't know what are the possible values without having the doc or diving into the code.

In Rust however you can get away with way less documentation because the type system and signatures are self explanatory. And if you're doing things right, the set of values you can pass to your function is limited.

1 comments

On the other hand, with Rust and Haskell you absolutely need type constructors to be easily discoverable. If open gives me an Fd, but the library function accepts a Stream, I shouldn't need to spend hours wading through sparse documentation to find how to convert between the two.

Something like Hoogle becomes a necessity if you want your type system to replace the need for documentation.