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

docs(tutorial): Clarify examples in chapter 5 #625

Merged
merged 1 commit into from
Nov 23, 2024

Conversation

Nukesor
Copy link
Contributor

@Nukesor Nukesor commented Nov 22, 2024

While going through the tutorial, I found the description on the last example of chapter 5 very confusing.

As a beginner, at this point of the tutorial I had the mental model that a Parser always consumes/advdances the input.
Suddenly take is introduced without any further info, which uses checkpoints under the hood.

And to make this even more confusing, the output of the parse_list parser is changed to "accumulat[e] the results into a ()", which really doesn't make a lot of sense if you don't know that take doesn't care about the output of the contained parser due to the checkpoint logic.

There's really a lot of concepts to unwrap in this small piece of code and it took a bit of research to figure out why stuff worked the way it does.

I hope the new text is able to convey this knowledge in a better way.

src/_tutorial/chapter_5.rs Fixed Show fixed Hide fixed
src/_tutorial/chapter_5.rs Fixed Show fixed Hide fixed
@coveralls
Copy link

coveralls commented Nov 22, 2024

Pull Request Test Coverage Report for Build 11985707946

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 41.568%

Totals Coverage Status
Change from base Build 11940029114: 0.0%
Covered Lines: 1299
Relevant Lines: 3125

💛 - Coveralls

@Nukesor Nukesor force-pushed the improve-chapter-5 branch 3 times, most recently from f803043 to d5e795d Compare November 22, 2024 15:05
src/_tutorial/chapter_5.rs Outdated Show resolved Hide resolved
src/_tutorial/chapter_5.rs Fixed Show fixed Hide fixed
src/_tutorial/chapter_5.rs Fixed Show fixed Hide fixed
@Nukesor Nukesor force-pushed the improve-chapter-5 branch 2 times, most recently from e80ebf7 to f8666ed Compare November 22, 2024 15:09
src/_tutorial/chapter_5.rs Outdated Show resolved Hide resolved
@epage
Copy link
Collaborator

epage commented Nov 22, 2024

Thank you for taking the time to fix this to help others in the future!

src/_tutorial/chapter_5.rs Outdated Show resolved Hide resolved
@epage epage merged commit e5e30b7 into winnow-rs:main Nov 23, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants