Hi john
I'm facing the following situation and I was wondering if a simple heuristic could not improve the situation (where edge cases will always be a problem).
I got a hierarchy of expressions implementing evaluate and I wanted to add a parameter (the binding). So Add Parameter worked but broke evaluate recursive methods.��
Here is a part of the book I'm writing
[[[��
EConstant >> testEvaluate��
self assert:(EConstant new value: 5) evaluate equals: 5
]]]��
is transformed as follows:��
[[[
EConstant >> testEvaluate
self assert: ((EConstant new value: 5) evaluateWith: Dictionary new) equals: 5
]]]
Your tests should nearly all pass except the ones on variables. Why do they fail?
Because the refactoring transformed message sends ==evaluate== but ==evaluateWith: Dictionary new== and this even in methods ==evaluate==.��
[[[
EAddition >> evaluateWith: anObject
^ (right evaluateWith: Dictionary new) + (left evaluateWith: Dictionary new)
]]]
[[[
EAddition >> evaluateWith: anObject
^ (right evaluateWith: anObject) + (left evaluateWith: anObject)
]]]
And I was wondering if a good heuristic would be to change the parameter.��
Now I have the impression that the refactoring is done it two passes.��
So this is more tricky than it looks.��
Stef