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

Add tests for E-expressions using simple system macros. #100

Merged
merged 2 commits into from
Jun 13, 2024

Conversation

toddjonker
Copy link
Contributor

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

@toddjonker toddjonker added the 1.1 Ion 1.1 design and implementation label Jun 5, 2024
(toplevel ('#$:make_string' "a" b ))
(toplevel ('#$:make_string' a "b"))
(produces "ab"))
// null.string and null.symbol act like ""
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting; does $0 also behave this way? I think I expected null arguments to be an error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great question, I tend to forget about $0. Heck, we also have absent symbols to deal with.

I cut amazon-ion/ion-docs#324 to deal with that later.

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 spec'd nulls to act like "" because their presence doesn't seem problematic enough to treat exceptionally. This way all (known) symbol and string values are accepted without error.

(The cases you call out are arguably encoding defects, so I think they deserve more global handling.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding a bit more detail on my thought process: the typed signature of this macro would be (text::v*) and I think its preferable for it to succeed given any text value. So that would include null.string and null.symbol for sure, and $0 is technically a valid non-null symbol. All of the above have no text, so I conclude that its reasonable to accept and ignore them (which happens to be indistinguishable from treating them as "").

Copy link
Contributor

@popematt popematt left a comment

Choose a reason for hiding this comment

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

Approving, but please check that @zslayton's concerns have been addressed before merging.

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.

I have reservations about accepting nulls in places that require a sequence or text, but we can go ahead and merge this.

@toddjonker
Copy link
Contributor Author

@zslayton I cut amazon-ion/ion-docs#327 -- and there's also amazon-ion/ion-docs#324 -- if those don't cover your concerns well, please comment there.

@toddjonker toddjonker merged commit 67a66d5 into amazon-ion:master Jun 13, 2024
@toddjonker toddjonker deleted the eexp branch June 13, 2024 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.1 Ion 1.1 design and implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants