-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Type Validation for Var Operations and Enhanced Compatibility #1674
Conversation
89e7ee1
to
5404411
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this approach is much cleaner!
…se for logical or btn vars. could be confusing for dicts
2258f7a
to
13536b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a couple comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for adding the extensive tests also. Should we remove the bitwise operator before merging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work, looks good to me
Description
This pull request addresses an issue where Var operations were previously allowed between any types, which led to unintended behaviors and potential edge cases. The purpose of this pull request is to align Var operations more closely with Python's type system and enforce type safety, especially considering that the codebase involves rendering operations in their JavaScript equivalents.
Changes Made
Motivation
In the context of our codebase, which primarily involves writing code in Python, it's important to ensure that the operations performed between State Vars are compatible with Python's type rules and restrictions.
By limiting operations to be more Python-specific, we can avoid unexpected behaviors, potential type errors, and edge cases that might arise from JavaScript's permissive type system.
This change is intended to enhance the reliability and maintainability of the codebase while maintaining consistency with Python's type-safe practices.
Impact
This change enforces stricter type validation for Var operations, which might result in some previously valid operations being flagged as errors. However, these changes are in line with Python's type-safe philosophy and aim to prevent unexpected behaviors.
Developers who were relying on the previously permissive type handling might need to review their code to ensure compatibility with the new type restrictions.