Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalization for long error codes explanations RFC #1567

Closed
wants to merge 2 commits into from
Closed

Normalization for long error codes explanations RFC #1567

wants to merge 2 commits into from

Conversation

GuillaumeGomez
Copy link
Member

We talked about it at the first meeting of the rust doc (unofficial) team so here it is: the RFC for the error codes explanations normalization!

cc @steveklabnik

Rendered.

@Stebalien
Copy link
Contributor

@GuillaumeGomez you might want to edit that title/commit message.

@GuillaumeGomez GuillaumeGomez changed the title Create 0000-long-error-codes-explanation-normalization.md Normalization for long error codes explanations RFC Apr 2, 2016
@GuillaumeGomez
Copy link
Member Author

@Stebalien: Oh indeed, I didn't pay attention... Thanks!

@steveklabnik
Copy link
Member

@Manishearth said 👍 on IRC.

I am generally in favor of this RFC, but I would also like to hear from the people who have contributed to these messages the most. I was going to check the issue we had for error codes, but cannot find it right now. @GuillaumeGomez , do you happen to have a link?

@alilleybrinker
Copy link

@steveklabnik, do you mean this issue?

@steveklabnik
Copy link
Member

@AndrewBrinker yes!

So, @michaelsproul, @lifthrasiir @lfairy @ruud-v-a @nham @caipre @cactorium @pnkfelix @AlisdairO @nathankleyn @joelmccracken and anyone else, thoughts on this RFC?

@pnkfelix makes a good point in that thread that isn't addressed here, but might be nice to add: rust-lang/rust#24407 (comment)


## First point

Giving a little more detailed error message. For example, the `E0109` spans "type parameters are not allowed on this type" and the error explanation says: "You tried to give a type parameter to a type which doesn't need it.".
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"For example, E0109 says "..."". "spans" isn't the right word to use here.

@GuillaumeGomez
Copy link
Member Author

Should error explanations include references to unstable features, that is, features that are hidden behind a feature-gate, and thus are unavailable in stable and beta channels of Rust?

I think they should since error explanations will come along with (normally) this unstable feature. But before that, they shouldn't be displayed or available for a non-nightly compiler.

@ruuda
Copy link

ruuda commented Apr 2, 2016

A few thoughts:

  • Sometimes very different situations that need to be fixed in different ways can lead to the same error. How would this template handle that?
  • For long code samples with a bit of boilerplate, perhaps they should not be repeated entirely if the fix is a one-liner? That would make it harder to test the examples, but it is also easier to see the which parts should be changed. Something like rustdoc’s # in examples might work.
  • Should this be interpreted as a loose starting point, or will all current explanations be shoehorned into this form? I am not necessarily opposed to this, but is the current situation so bad?

Providing an unified template is needed in order to help people who would want to write ones as well as people who read them.

I can see how this helps writing new examples, but I don’t see how this will help users.

@Manishearth
Copy link
Member

Sometimes very different situations that need to be fixed in different ways can lead to the same error. How would this template handle that?

Just mention each. We do this already. https://doc.rust-lang.org/nightly/error-index.html#E0401 is an example

For long code samples with a bit of boilerplate, perhaps they should not be repeated entirely if the fix is a one-liner? That would make it harder to test the examples, but it is also easier to see the which parts should be changed. Something like rustdoc’s # in examples might work.

we don't yet test code examples in the index. But if we did, that would be correct.

Should this be interpreted as a loose starting point, or will all current explanations be shoehorned into this form? I am not necessarily opposed to this, but is the current situation so bad?

IMO loose starting point. Current explanations follow this more or less, since I've been unofficially enforcing something close to this set of guidelines when reviewing this PRs.

@GuillaumeGomez
Copy link
Member Author

Sometimes very different situations that need to be fixed in different ways can lead to the same error. How would this template handle that?

Such cases are very rare. However, I think it'll be best to consider this PR as a base to apply as much as possible and then handle exceptions "by hand".

For long code samples with a bit of boilerplate, perhaps they should not be repeated entirely if the fix is a one-liner? That would make it harder to test the examples, but it is also easier to see the which parts should be changed. Something like rustdoc’s # in examples might work.

You're supposed to provide a code example as small as possible to isolate the error and to show from where it comes.

Should this be interpreted as a loose starting point, or will all current explanations be shoehorned into this form? I am not necessarily opposed to this, but is the current situation so bad?

I think it should be used as a base. The current situation isn't that bad, but can be greatly improved.

I can see how this helps writing new examples, but I don’t see how this will help users.

We're currently trying to uniformize all rust docs as well. Just like you won't have a website which changes style between pages for consistency, we're trying to apply it here as well to not loose users.

@GuillaumeGomez
Copy link
Member Author

we don't yet test code examples in the index. But if we did, that would be correct.

@Manishearth: We actually do. I added it here.

@joelmccracken
Copy link

I can see how this helps writing new examples, but I don’t see how this will help users.

A template, in a way similar to a checklist, helps ensure that an error message contains everything that it should. I like it.

I suggest that the labels for the points in the template might improve. This would make the template itself easier to read and work with:

[First point] -> [Slightly more detailed error message. 50-100 words.]
[Second point] -> [Code the exemplifies the problem. 5-10 lines.]
[Third point] -> [Why the error occurs and how it may be fixed. 100-200 words.]
[Fourth point] -> [Fixed version of the earlier example. 5-10 lines.]
[Fifth point] -> [Additional details and supplementary information]

@GuillaumeGomez
Copy link
Member Author

No, I prefer avoid adding limits. Some error messages need to be really complete. If I set a word "limit", they'll focus on it and I want to avoid that.

@joelmccracken
Copy link

Sure, that makes sense. The word limit was an afterthought, anyway.

> fn cake();
> }
> ```
> "##,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is messed up with the code blocks here!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything wrong. What are you referring to?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @bjz is referring to the fact that ""##," displays inline in the rendered markdown. I am not sure if that is intentional but it does look a little odd on the page.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arf, I don't know how markdown works in there. I was expecting that it wouldn't "interpret" in quote block.

@AlisdairO
Copy link

👍 sounds like a great plan to me!

@nrc nrc added the T-dev-tools Relevant to the development tools team, which will review and decide on the RFC. label Apr 4, 2016
@nrc
Copy link
Member

nrc commented Apr 5, 2016

Why are the labels "first point" etc.? A more semantic label/title/guideline would make more sense to me.

I'd be keen to emphasise that the template is a guideline, rather than a requirement - good docs often need quite a lot of specialisation, and docs which are obviously forced into a template often read badly.

Having said that, +1 on the RFC overall.

@GuillaumeGomez
Copy link
Member Author

Why are the labels "first point" etc.? A more semantic label/title/guideline would make more sense to me.

With what would you replace it?

I'd be keen to emphasise that the template is a guideline, rather than a requirement - good docs often need quite a lot of specialisation, and docs which are obviously forced into a template often read badly.

I wrote a lot of error code explanations, and that's the more common template I fulfilled. Of course, this is "just" a guideline and some cases can't fulfill it (this template), but they remain exceptions and have to be treated on their own (even if they remain close to this RFC).

However, I think it's preferable to have a guideline and start to write something from it and then specialize the explanation if needed (and you can do it a lot). That's what has been done unofficially like @Manishearth said and it worked well.

@gnzlbg
Copy link
Contributor

gnzlbg commented Apr 12, 2016

@GuillaumeGomez

With what would you replace it?

Still needs some work but we can try to make obvious what each section should contain

  • First point -> Error description
  • Second point -> Minimal example
  • Third point -> Error explanation
  • Four point -> How to fix it
  • Fifth point -> Supplementary information

@GuillaumeGomez
Copy link
Member Author

@gnzlbg: I see, I'll update it.

@joelmccracken
Copy link

I was also trying to say this. Ignore the bits I said about the word count; the other part is label name suggestions.

@GuillaumeGomez
Copy link
Member Author

Updated.


# Summary

Long error codes explanations haven't been normalized yet. For example, actually, not all error codes explanation provide an erroneous code example or a way to fix the error. This RFC intends to clarify this by providing a template to follow.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"For example, actually" can become "For example".
"not all error codes explanation" -> "not all error code's explanations"
"This RFC intends to clarify this by providing a template to follow." -> "This RFC intends to clarify long error codes by providing a template to follow".

@steveklabnik
Copy link
Member

steveklabnik commented May 18, 2016

Okay everyone! It seems like the discussion here has largely died down, so we are moving this RFC into its final comment period! 🎊

@steveklabnik steveklabnik added the final-comment-period Will be merged/postponed/closed in ~10 calendar days unless new substational objections are raised. label May 18, 2016
@aturon
Copy link
Member

aturon commented May 27, 2016

Took a read through this morning, and this RFC looks great to me. Thanks @GuillaumeGomez!

@GuillaumeGomez
Copy link
Member Author

Thanks for your feedback @aturon!

@brson
Copy link
Contributor

brson commented Jun 1, 2016

lgtm

@zackmdavis
Copy link
Member

Like @nham, I'm not enthusiastic about standardizing on the verbatim phrase "Example of erroneous code:".

@alilleybrinker
Copy link

I wonder, is erroneous a bit of a poor word choice in this context? Not everyone programming in Rust speaks/reads English as their first language, and it may be preferable to choose a simpler word for this reason.

@GuillaumeGomez
Copy link
Member Author

I'm french and I don't see the problem with this word (and I don't think that I have an amazing english level).

@ticki
Copy link
Contributor

ticki commented Jun 8, 2016

I am terrible at english, and I don't see a problem neither.

@Manishearth
Copy link
Member

How about "Sample (or example) of incorrect code:"?

@alilleybrinker
Copy link

@Manishearth, this wording sounds better to me. Also, I realize this is a minor issue. If it's really not an issue in practice (and @GuillaumeGomez and @ticki seem to think it isn't), it may not be worth a change.

@GuillaumeGomez
Copy link
Member Author

We already debated about this sentence. I don't know what to add about it. I put back the url.

@steveklabnik
Copy link
Member

Huzzah! The not-quite-real docs team, in conjunction with the core team, has decided to accept this RFC. Thank you all!

@steveklabnik
Copy link
Member

I had to do a rebase, so #1648 closed this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
final-comment-period Will be merged/postponed/closed in ~10 calendar days unless new substational objections are raised. T-dev-tools Relevant to the development tools team, which will review and decide on the RFC.
Projects
None yet
Development

Successfully merging this pull request may close these issues.