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

p:ixml should always wrap output into ixml element #494

Open
innovimax opened this issue Jan 24, 2022 · 2 comments
Open

p:ixml should always wrap output into ixml element #494

innovimax opened this issue Jan 24, 2022 · 2 comments

Comments

@innovimax
Copy link
Contributor

I think that the principle of least surprise (POLA) enforce the idea that the output should be consistent whatever the context we're in

At the moment, the specification as it is gives different ixml or no wrapper on different context

  • example 1 : ixml wrapper
  • example 2 : no wrapper
  • example 3 : ixml wrapper
  • example 4 : no wrapper
  • example 5 : no wrapper
  • example 6 : ixml wrapper

I would recommend that example 2, 4 and 5 to add a wrapper to avoid surprises

@ndw
Copy link
Collaborator

ndw commented Jan 24, 2022

I don't think so. In the case where the grammar parses successfully and a single parse is returned, the root element is determined by the users grammar. In the first example, the root element is ixml because that's the root element in the ixml grammar. In the third example, I added ixml because the parse failed. In the sixth example, I added ixml because the user asked for multiple parses. On further thought, the step should probably just return a sequence of results in that case.

@innovimax
Copy link
Contributor Author

Then perhaps, unwrapping example 3 and example 6 would do the trick

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

3 participants