Closed Strilanc closed 7 years ago
This is actually a subset of another PR that you approved...?
There were two big complicated methods, but they were almost identical. Any bugfix you make to one would have to be repeated on the other. Any feature you added to one would also be added to the other. There's no reason to do all that work, and all that reading, twice. This pulls out their common structure so that changes only have to be made once.
Ok, just change the names as I mentioned and I will approve.
Is the name 'position vector' / 'momentum vector' appropriate? When doing the inverse transform they would be the opposite of what they should be. I'm very happy to use good names instead of generic ones, and I defer to your expertise on knowing the better names for these methods, but we should avoid directly misleading names.
@babbush Please suggest alternative names (or just say to go with pos/mom) so that this can get pushed; it will have merge conflicts with some of the grid changes.
They're large almost identical methods, so I merged them into a helper then called it with slightly different arguments.
I did it in two stages:
Making the same except for assignments at the top. I used rename refactorings to fix differences in variable names. I fixed differences in logic by depending on the assignment values instead of hard-coded functions. I confirmed the function tails were exactly identical at this point by pasting one over the other and confirming no diff.
Moving the common bodies into a method then calling it.