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

(interpreter) Warn on ambiguous combination of boolean operators #256

Merged
merged 1 commit into from
Jan 21, 2022

Conversation

perlun
Copy link
Collaborator

@perlun perlun commented Jan 21, 2022

This has been an idea of mine since a long time. Quoting #245:

Doing things which are considered "hard-to-from" from an ambiguity should produce a compile-time error. I am thinking about expressions like this:

true && false || false

Without digging up a book/Internet resource, can you by heart say what the above will produce in the language you use everyday?

(The right answer is typically false since || has higher precedence than &&. In other words, the above should be read as true && (false || false).)

What Perlang aims to do here

We want to make it impossible to write the above, ambiguous code. The compiler should complain and enforce the usage of clarifying parentheses in this case.

Closes #245.

@perlun perlun added the enhancement New feature or request label Jan 21, 2022
@perlun perlun added this to the 0.1.0 milestone Jan 21, 2022
@perlun perlun force-pushed the feature/warn-on-ambiguous-boolean-operators branch from 0b0e420 to 1bbe793 Compare January 21, 2022 19:27
@perlun perlun enabled auto-merge (squash) January 21, 2022 19:27
@perlun perlun merged commit d574b95 into master Jan 21, 2022
@perlun perlun deleted the feature/warn-on-ambiguous-boolean-operators branch January 21, 2022 19:29
@perlun perlun added the language Language features (or bugs) label Feb 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request language Language features (or bugs)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add boolean operators
1 participant