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 test cases for add/set_symbols and add/set_macros #136

Merged
merged 4 commits into from
Nov 22, 2024

Conversation

popematt
Copy link
Contributor

Issue #, if available:

#88

Description of changes:

Adds test cases for add_symbols, set_symbols, add_macros, and set_macros.

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

@popematt popematt requested a review from tgregg November 21, 2024 00:08
Copy link
Contributor

@zslayton zslayton left a comment

Choose a reason for hiding this comment

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

🚀

// add_macros does not have any side-effects on the symbol table
// add_macros should append its arguments to the macro table of the default module
// annotations on any argument value should signal an error (because it's not allowed in the macro table rather than because of any specific validation by the add_macros macro)
// TODO: add_macros can accept a module name (of a loaded module) as an argument?
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think so. The options would be:

  • (macro name () body) to define a macro in-situ.
  • macro_ref (qualified or unqualified) to add an already-defined macro
  • module_name::* to add all of module_name's exported macros

Note that foo would be considered an unqualified macro name rather than a module, which is why foo::* exists.

(toplevel '#$1' '#$65' '#$66')
(produces '$ion' 'make_field' ''))))

(ion_1_1 "add_symbols can accept"
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly, I think add_symbols and set_symbols would also be able to accept module_name::*.

conformance/system_macros/add_symbols.ion Outdated Show resolved Hide resolved
Comment on lines +4 to +5
// TODO: set_macros can accept a module name (of a loaded module) as an argument?
// TODO: set_macros can accept a module/macro export?
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thoughts as on add_macros.

Comment on lines +4 to +5
(ion_1_1 "set_symbols can be invoked"
(each "in text with an unqualified macro name"
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment RE: module_name::*.

conformance/system_macros/set_symbols.ion Outdated Show resolved Hide resolved
conformance/system_macros/add_macros.ion Outdated Show resolved Hide resolved
conformance/system_macros/set_macros.ion Outdated Show resolved Hide resolved
(each (text "(:$ion::add_symbols)")
(text "(:$ion::add_symbols 'a')")
(text "(:$ion::add_symbols 'a' 'b')")
// TODO: If it's not too difficult, assert that no macros are added
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you just assert that attempting to invoke (:1) fails due to an unknown address?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe, but I'm going to wait for the dust to settle on the Modules part of the spec first.

conformance/system_macros/set_symbols.ion Outdated Show resolved Hide resolved
@popematt popematt merged commit ca9410f into amazon-ion:main Nov 22, 2024
1 check passed
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