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

opt_each is badly named and an actual opt_each should be provided #481

Open
jbigot opened this issue Oct 14, 2024 · 1 comment
Open

opt_each is badly named and an actual opt_each should be provided #481

jbigot opened this issue Oct 14, 2024 · 1 comment

Comments

@jbigot
Copy link
Member

jbigot commented Oct 14, 2024

What opt_each currently handles is a situation where we can have each of these two options:

key: "a single value"

or

key:
 - "a first value"
 - "a second value"
 - "and some more..."

This would be better named one_or_each.

On the other hand, we miss a function to handle the case where we look for 0 or more values, that is, where the key might be completely missing.
This could maybe be written like that:

// for a list
each(tree, or_none, [](PC_tree_t value) {
}
// for a mapping
each(tree, or_none, [](PC_tree_t key, PC_tree_t value) {
}

that way, the variant could be easily added to all functions.

@benoitmartin88
Copy link
Member

update deisa plugin when this issue is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants