How to report Elixir documentation that may be incorrect?

I have noticed some discrepancy in the elixir official documentation and would like to know two things. First, if it is an error or I am missing something. Second, how to report it to the elixir team to update the documentation if it’s truly incorrect.

On this link the inspect optional parameters are syntaxed as pretty: true, width: 0
https://hexdocs.pm/elixir/Kernel.html#inspect/2

But in this documentationm :pretty and :width parameters are listed as atoms.
https://hexdocs.pm/elixir/Inspect.Opts.html#content

So is there something I am not getting? Or it’s a documentation error I need to report? Help appreciated. But the version that works is the first one set in the examples.

It’s not an error.

inspect([1, 2, 3], pretty: true, width: 0)

# is equivalent to

inspect([1, 2, 3], [pretty: true, width: 0])

# is equivalent to

inspect([1, 2, 3], [{:pretty, true}, {:width, 0}])

Effectively, pretty: is syntactic sugar.

It behaves similarly for maps, where

%{foo: 1}

# is equivalent to

%{:foo => 1}

You can create an issue here: Issues · elixir-lang/elixir · GitHub

Or, if you know what it’s suppose to be, just fix it.

4 Likes

Thanks for your prompt feedback, that is interesting. So I assume they’re both regarded as :atoms by the underlying compiler.

Yes, that’s the case.

1 Like

For future reference: The Elixir Core team (as well as most library owners) take a mistake or oversight in the documentation as seriously as a bug in the code :slight_smile:. Standard procedure is to open an issue on the respective code repository to tell them about the problem.
Elixir devs do not bite; rather we are eternally grateful if someone spots an oversight that we’d missed because it improves the software for everyone! :stuck_out_tongue_winking_eye:

4 Likes

I’ve actually responded to problems with the documentation several times by submitting pull requests with changes. They have all been well received.

2 Likes

Just in case my post title is misunderstood. I am not afraid to report any documentation problems, but the original title of my post was not phrased like that. When the moderator changed the title to a clear question like that, it gives the impression that “I had tried to report before and it did not work”. Which is not the case :slight_smile:

My first interactions with the community was submitting PRs for documentation issues I noticed when first discovering the language over 5 years ago. It was awesome how graceful and egoless the core team was, and is impressive how well that empathy has scaled with the size and velocity of the language today!

3 Likes