Skip to content

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

any number of the 3 kinds of generators above. Zip generators can be used
in list, binary, or map comprehensions in the same way.

For example, if the two generators in the above example is combined together
Copy link
Contributor

Choose a reason for hiding this comment

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

are combined

@kikofernandez kikofernandez merged commit 471cc7e into erlang:master Oct 28, 2024
1 check 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.

5 participants