Simple Summary
Add short circuiting logic to binary operations.
Motivation
- This is pretty standard behavior in most programming languages - I believe the majority of users will assume that it already happens and write their code accordingly.
- By not doing it, we make transactions less efficient through unnecessary evaluation.
- We introduce a risk for exploits due to unexpected behavior:
@private
def a() -> bool:
return True
@private
def b() -> bool:
steal_the_money()
return True
@public
def foo():
if a() or b():
# something mostly harmless
Specification
Treat and and or as short-circuit operators: evaluate them left to right, and stop evaluation as soon as an outcome is determined.
Backwards Compatibility
This will alter behavior in contracts, but should not introduce any breaking changes.
Copyright
Copyright and related rights waived via CC0
Simple Summary
Add short circuiting logic to binary operations.
Motivation
Specification
Treat
andandoras short-circuit operators: evaluate them left to right, and stop evaluation as soon as an outcome is determined.Backwards Compatibility
This will alter behavior in contracts, but should not introduce any breaking changes.
Copyright
Copyright and related rights waived via CC0