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

disambiguate empty sets from empty maps #252

Closed
wants to merge 4 commits into from
Closed

Conversation

divarvel
Copy link
Collaborator

according to the grammar, {} could either mean empty set or empty map. Due to how the parser was written, it was always an empty set, and there was no way to have an empty map literal.

This is an issue because empty maps would still be displayed as {}, and maps have a different api than sets, resulting in evaluation errors.

This commit introduces {,} as the empty set literal, while {} is the empty map. The goal here is to be consistent with JSON, the reason why we chose the current syntax for arrays and maps.

according to the grammar, `{}` could either mean *empty set* or *empty map*. Due to how the parser was written, it was always an empty set, and there was no way to have an empty map literal.

This is an issue because empty maps would still be displayed as `{}`, and maps have a different api than sets, resulting in evaluation errors.

This commit introduces `{,}` as the empty set literal, while `{}` is the empty map. The goal here is to be consistent with JSON, the reason why we chose the current syntax for arrays and maps.
Copy link

codspeed-hq bot commented Nov 29, 2024

CodSpeed Performance Report

Merging #252 will not alter performance

Comparing empty-set-literals (60bf915) with v5 (fc0d069)

Summary

✅ 12 untouched benchmarks

@divarvel divarvel force-pushed the empty-set-literals branch 2 times, most recently from 3accb7a to 022120c Compare November 29, 2024 10:57
@divarvel divarvel requested a review from Geal November 29, 2024 10:57
@divarvel divarvel force-pushed the empty-set-literals branch 2 times, most recently from 5a2a5fb to 3cceb75 Compare November 29, 2024 11:43
@divarvel
Copy link
Collaborator Author

coverage is OK, with tarpaulin run locally: 66.12% coverage, 5033/7612 lines covered, +0.54% change in coverage

i haven’t found the reason why tarpaulin fails in CI

Comment on lines 746 to 747
#[cfg(test)]
const DEFAULT_DURATION_MILLIS: u64 = 1;
#[cfg(not(test))]
const DEFAULT_DURATION_MILLIS: u64 = 10_000;
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't they be reversed? The longer one in tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🤦

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

(i had removed the commit anyway but i’ll give another try)

@divarvel divarvel mentioned this pull request Nov 30, 2024
@divarvel divarvel closed this Nov 30, 2024
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.

2 participants