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

Adds text descriptions for intended system macro test cases #128

Merged
merged 4 commits into from
Nov 14, 2024

Conversation

popematt
Copy link
Contributor

@popematt popematt commented Nov 8, 2024

Issue #, if available:

#88

Description of changes:

This adds text descriptions of test cases that will be added. I have chosen to start with this as a way to try to quickly align on the behavior of the macros and ensure there is no unspecified behavior before I start writing full test cases for all of these.

When reviewing, of course call out anything that might be incorrect, but also consider if there's anything that is missing or unspecified. That being said, you can assume that the system macro signatures in the specification are also going to be tested even though I have not called each of them out explicitly in the test descriptions.

I've also added a copyright header to the grammar.isl and rearranged + added an overview in the README.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

conformance/README.md Show resolved Hide resolved
conformance/README.md Outdated Show resolved Hide resolved
conformance/README.md Outdated Show resolved Hide resolved
conformance/README.md Outdated Show resolved Hide resolved
Comment on lines +47 to +49
The inner clauses should align with the formal data model in the denotational
semantics, which would (more or less) reduce the components to integers and
strings.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The denotational semantics are not yet available on GitHub, so I wonder if this will be confusing than enlightening.

EDIT: I see now that this section was relocated from below.

conformance/system_macros/make_timestamp.ion Outdated Show resolved Hide resolved
conformance/system_macros/meta.ion Outdated Show resolved Hide resolved
// parse_ion can read Ion 1.0 and Ion 1.1, text and binary

// parse_ion always produces user values
// - but if the result passes through other macros it could turn it into a system value...?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. And that's ok because the other macros are allowed to affect the current encoding context while the values in the nested stream are not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what about this?

$ion_1_1

$4 // name

(:values (:parse_ion '''$ion_1_1 $ion_literal::$ion_symbol_table::{symbols:["a", "b", "c", "d"]}''' ))

$4 // d

Are we okay with letting system values leak from parse_ion when it's wrapped in another macro/e-expression, and with the fact that values is no longer an identity function in this scenario?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that use case works. Values coming out of parse_ion cannot be system values; if they "look like" a system value, parse_ion will escape them in the output.

Copy link
Contributor Author

@popematt popematt Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, parse_ion actually prepends $ion_literal:: to anything that could be a system value? (Or retains, depending on how you look at it.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created amazon-ion/ion-docs#365 to clarify this so as not to delay this PR.

conformance/system_macros/repeat.ion Outdated Show resolved Hide resolved
// Test Cases:
// set_macros can be invoked by name, address, qualified address, qualified name, binary address, and binary system e-expression op code.
// the argument values may be zero or more macro definitions
// TODO: Could it also be a module or an export?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Off-hand I think yes for both this and add_macros? mod_a::* and macro_foo both seem reasonable.

Though there is something to be said for the charm of macro-shaped parameters here:

(:set_macros
   (foo () ...)
   (bar () ...)
   (baz () ...)
)

Probably not worth precluding the other options, though. I suppose we could have a separate def_macros that only took macro definitions.

conformance/system_macros/add_symbols.ion Outdated Show resolved Hide resolved
conformance/system_macros/set_macros.ion Outdated Show resolved Hide resolved
conformance/system_macros/annotate.ion Outdated Show resolved Hide resolved
conformance/system_macros/flatten.ion Show resolved Hide resolved
popematt and others added 3 commits November 13, 2024 12:38
@popematt popematt merged commit d6ffc3c into amazon-ion:main Nov 14, 2024
@popematt popematt deleted the macro-intents branch November 14, 2024 19:24
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 this pull request may close these issues.

3 participants