Repository navigation
Conversation
Allow a map key in a pattern to use variables bound by other parts of
the same pattern, as in f(K, #{K := V}), in any order, as long as the
keys do not depend on each other in a cycle.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This EEP proposes that a map key in a pattern can use variables bound by other parts of the same pattern, in any order, as long as the keys do not depend on each other in a cycle:
EEP 43 described this when maps were introduced, but it was never implemented. The EEP also covers the problems that shelved the 2020 prototype: repeated variables such as
foo(#{K := K}, K)work, and programs that stay invalid get the same error messages as today.erl_lint,v3_core,erl_evaland the debugger, with tests and updates to the Reference Manual.🤖 Generated with Claude Code