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 map wrongly requires i0 and i in the argument list #320

Open
dynaxis opened this issue Jun 28, 2024 · 0 comments · May be fixed by #321
Open

Zip map wrongly requires i0 and i in the argument list #320

dynaxis opened this issue Jun 28, 2024 · 0 comments · May be fixed by #321

Comments

@dynaxis
Copy link

dynaxis commented Jun 28, 2024

According to the user guide:

parens(x) ::= "(<x>)"
main() ::= "<["a", "b", "c"]:parens()>"

works and actually does fine. But the following doesn't:

parens(x, y) ::= "(<x>, <y>)"
main() ::= "<["a", "b", "c"], ["1", "2", "3"]:parens()>"

The error says parens requires i0 and i. So the following works:

parens(x, y, i, i0) ::= "(<x>, <y>)"
main() ::= "<["a", "b", "c"], ["1", "2", "3"]:parens()>"

The same works with anonymous template as follows:

parens(x, y) ::= "(<x>, <y>)"
main() ::= "<["a", "b", "c"], ["1", "2", "3"]:{x, y | parens(x, y) }>"

If i and i0 are intended to be available only in anonymous subtemplates (the doc seems suggesting so),
then at least the behavior must be consistent across non-zipping and zipping cases.

In non-zipping case, i and i0 aren't required and even if we specify them, no indices are passed in.
But in zipping case, if we add i and i0 to the argument list, the proper indices are passed in.

That's weird to me.

UPDATE: I read Interpreter.java and for the zip_map, if (st.impl.isAnonSubtemplate) check around st.rawSetAttribute("i0", i0) seems omitted by mistake. rot_map and rot_map_iterator have one.

@dynaxis dynaxis changed the title Zip map requires i0 and i in the argument list Zip map wrongly requires i0 and i in the argument list Jun 28, 2024
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 a pull request may close this issue.

1 participant