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

Clarify whether symbols that "look like" an IVM are allowed #73

Open
zslayton opened this issue Oct 18, 2021 · 2 comments
Open

Clarify whether symbols that "look like" an IVM are allowed #73

zslayton opened this issue Oct 18, 2021 · 2 comments

Comments

@zslayton
Copy link
Contributor

The Ion spec's Symbols section description says:

In Ion text, the Ion Version Marker (IVM) is represented by the following symbol.

$ion_1_0

This stand-alone symbol is recommended at the start of Ion text data. It identifies a specific major/minor version of the Ion notation. It resets the current symbol table to be the corresponding system symbol table, and simultaneously switches the parser into the appropriate mode for parsing the right version of Ion notation.

There is no broader discussion of Ion Version Marker syntax; in particular, no syntax is reserved for future Ion Version Markers. Readers might reasonably assume that IVMs always follow the format $ion_MAJOR_MINOR, but this is not actually provided for by the spec. The System symbols section of the spec says:

Each version of the Ion specification defines the corresponding system symbol table version. Ion 1.0 uses the "$ion" symbol table, version 1, and future versions of Ion will use larger versions of the "$ion" symbol table. $ion_1_1 will probably use version 2, while $ion_2_0 might use version 5.

suggesting that the intent was to formalize $ion_MAJOR_MINOR. However, without an explicit requirement in the spec, it is unclear whether an Ion 1.0 text reader that encountered $ion_2_0 in a stream should treat it as:

  • An Ion Version Marker indicating that the stream is not readable by a 1.0 reader
    OR
  • A user-level symbol using identifier syntax and the reserved $ion_* prefix

We should clarify the spec and add a test enforcing the expected behavior.

@jobarr-amzn
Copy link

@zslayton
Copy link
Contributor Author

Agreed. It's also referenced (but not defined! 😬) in the ANTLR grammar.

I think the spec should say it. As a developer, I want to be able to implement Ion by looking at the spec. I don't want to have to take a survey of the spec, ion-tests, and popular implementations to figure out what the Right Thing To Do ™️
is.

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

No branches or pull requests

2 participants