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

Boolean compound assignment operators should short-circuit if possible #2864

Closed
anqit opened this issue Feb 25, 2023 · 3 comments
Closed

Boolean compound assignment operators should short-circuit if possible #2864

anqit opened this issue Feb 25, 2023 · 3 comments
Labels
feature Proposed language feature that solves one or more problems state-duplicate This issue or pull request already exists

Comments

@anqit
Copy link

anqit commented Feb 25, 2023

Currently, there is an inconsistency between the behavior of boolean compound assignment operators (|= and &=) and their plain syntax supposed-to-be-equivalents, in that the former does not use short-circuiting when the left operator determines the result of the boolean expression so the right operator does not need to be evaluated. This dartpad demonstrates the difference:
https://dartpad.dev/?id=cab11271c6d481729b457e5a1585aa88

I believe that the assignment operators should be updated to use short-circuiting when possible.

@anqit anqit added the feature Proposed language feature that solves one or more problems label Feb 25, 2023
@lrhn lrhn added the state-duplicate This issue or pull request already exists label Feb 25, 2023
@lrhn
Copy link
Member

lrhn commented Feb 25, 2023

That should be &&= and ||= instead. See #23

@lrhn lrhn closed this as completed Feb 25, 2023
anqit added a commit to anqit/multiple_search_selection that referenced this issue Feb 25, 2023
esentis pushed a commit to esentis/multiple_search_selection that referenced this issue Feb 25, 2023
esentis pushed a commit to esentis/multiple_search_selection that referenced this issue Feb 25, 2023
* fix short-circuiting due to dart-lang/language#2864

* update operator

turns out the "double" version of the operators does short-circuit
@anqit
Copy link
Author

anqit commented Feb 25, 2023

@lrhn is there a specific language version that &&=/||= are found in? I've tried modifying my code to use those operators instead and it is not compiling.
Also, I don't see them listed in the docs: https://dart.dev/guides/language/language-tour#assignment-operators

@natebosch
Copy link
Member

&&= and ||= are not existing language features. This issue is closed as a duplicate of #23 which is an existing issue requesting them as new features.

esentis added a commit to esentis/multiple_search_selection that referenced this issue Mar 5, 2023
* ♻️ 🎨 Improves structure & refactors methods

* 📝 Documents changes

* ⬆️ Bumps version to 2.3.6

* call remove once; other small fixes (#22)

* 📝 Updates CHANGELOG

* ✨ Adds pickedItemsContainerBuilder

Closes #23

* ⬆️ Bumps version to 2.3.7

* 📝 Documents changes

* Allow setting controllers and a couple other customizations (#24)

* providable nodes and controllers

* customize hint text and allow clearing field

* undo input decoration

* use custom picked items builder for empty lists also

* re-add custom input decoration

* ⬆️ Bumps version to 2.4.0

* 📝 Documents changes

* 🤡 Tweaks example code

* 💥 ✨ Refactors showed items with lazy loading

* 🐛 Adds missed shrinkwrap

* ⬆️ Bumps version to 2.4.1

* 📝 Documents changes

* fix short-circuiting due to dart-lang/language#2864 (#25)

* Avoid unnecessary fuzzy search (#26)

* fix short-circuiting due to dart-lang/language#2864

* update operator

turns out the "double" version of the operators does short-circuit

* Revert "Avoid unnecessary fuzzy search (#26)" (#27)

This reverts commit 7aaed22.

* ⬆️ Bumps version to 2.4.2

* 📝 Updates CHANGELOG

* fix: outerContainerColor (#28)

* fix: outerContainerColor

* fix: outerContainerDecoration

* ⬆️ Bumps version to 2.4.3

* 📝Updates CHANGELOG

* 🐛 Resolves decoration discrepancies

---------

Co-authored-by: anqit <anqit.praqash@gmail.com>
Co-authored-by: Julia Bulgakova <37380842+Luvti@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Proposed language feature that solves one or more problems state-duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants