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

Link out to wiki page for the concept of a "generator" #2985

Merged
merged 5 commits into from
Mar 4, 2024

Conversation

hongtron
Copy link
Contributor

The term "generator" is used in a couple spots in the docs (e.g. in For Comprehensions in the Tour of Scala), but is never defined. As an alternative to this change, I welcome (and would even prefer) proposed definitions for the term, if the Scala concept does not completely line up with the wiki content - but I do not feel qualified to venture a definition myself.

@bishabosha
Copy link
Member

Hey, thank you for opening this PR! We can definitely do more to make a reusable definition to explain what is meant by "generator". Probably the best is from this page

The code i <- ints is referred to as a generator.

Perhaps we can copy that to the tour and a taste of scala

My suggestion for improvement would be

The code i <- ints is referred to as a generator. In any generator p <- e, the expression e can generate zero or many bindings to the pattern p.

@hongtron
Copy link
Contributor Author

hongtron commented Mar 1, 2024

Thank you for your feedback! I've pushed some changes to incorporate your definition, and update the other spots you called out.

I also made two other wording changes, which I've broken into separate commits for emphasis (one regarding the phrase "semicolon-separated," and one replacing "filter" with "guard"). Let me know if you think they make sense.

Copy link
Member

@bishabosha bishabosha left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!

@bishabosha bishabosha merged commit 01450a1 into scala:main Mar 4, 2024
1 check passed
@hongtron hongtron deleted the patch-1 branch March 7, 2024 17:28
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.

2 participants