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

ENH: compare op enum and instr equality #30

Merged
merged 2 commits into from
Dec 15, 2015
Merged

Conversation

llllllllll
Copy link
Owner

This cleans up some rough edges I saw in Jim's codetransformer.

  • Makes COMPARE_OP use enums for the input. There are also class level constructors for the different types like: COMPARE_OP.LT
    note: COMPARE_OP.LT is not COMPARE_OP.LT. This means we can use these for equality or take ownership and start jumping to them and so on. The integer enum is COMPARE_OP.comparators.
  • Makes the jump instruction constructor manage the _target_of set of the argument.
  • Adds a way for subclasses to type check and normalize their inputs.

@jcrist
Copy link

jcrist commented Dec 11, 2015

This looks good to me. I've been enjoying playing with this - the pattern matching api is very intuitive to use (once I figured out how it works). Thanks for cleaning up some of the rough edges here :)

@llllllllll
Copy link
Owner Author

Thanks, I am glad you are having fun with this. I am going to revert the __eq__ change. This makes too many operation abigious. The fact that hash(a) != hash(b) | a == b is a big red flag that this is a bad design. I will instead make an equiv method that checks on type and arguments while still letting == do identity.

@llllllllll llllllllll force-pushed the compare-op-enum branch 3 times, most recently from 3a5fd65 to 1f7f0c0 Compare December 11, 2015 07:21

Notes
-----
This is a seperate concept from instruction identity. Two seperate
Copy link
Collaborator

Choose a reason for hiding this comment

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

separate

DOC: Explain how `ComparatorDescr` works.
@ssanderson
Copy link
Collaborator

LGTM modulo spelling comment.

@llllllllll llllllllll merged commit ea75b9f into master Dec 15, 2015
@llllllllll llllllllll deleted the compare-op-enum branch December 15, 2015 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants