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

Zip generator for comprehensions #65

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

lucioleKi
Copy link
Contributor

This EEP proposes the addition of zip generators with a syntax of && for
comprehensions in Erlang. The idea and syntax of zip generators (comprehension
multigenerators) was first brought up by EEP-19. Even if the syntax and
usages of zip generators proposed by this EEP is mostly the same with EEP-19,
the comprehension language of Erlang has undergone many changes since EEP-19
was accepted. With an implementation that is compatible with all existing
comprehensions, this EEP defines the behavior of zip generators with more
clarification on the compiler's part.

eeps/eep-0073.md Outdated

When a zip generator crashes because the containing generators are of
different lengths, the error message is a tuple, where the first element
is the atom `bad_generators`, and the second element is a tuple that contains
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: I believe all of the errors raised by Erlang do not have a _ after bad. You have badarg, badfun, badkey, badmap, etc. I would probably keep it consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's my bad. I should write the user-facing error message, not just the internal one. Some errors in erl_error.erl use _ though, like bad_generator, but it's internal. Thanks for pointing it out :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, if we already have bad_generator, then bad_generators make the most sense. Thank you!

eeps/eep-0073.md Outdated
then becomes a special case of comprehension where only zip generators are
used.

In summary, zip generator removes the user's need to call the zip function
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
In summary, zip generator removes the user's need to call the zip function
In summary, zip generators removes the user's need to call the zip function

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