"TimM" <
[hidden email]> wrote in message
news:
[hidden email]...
> Is there a technical reason why you can't refactor unless you save your
> method?
>
The basic reason is that many of the refactorings also affect other code
artefacts, and so it would not be preserving behaviour to apply a
refactoring across saved methods/class definitions that are currently in use
as well as unsaved code. I suppose this is one of the differences with
coding in a live environment, rather than a set of unsaved files. Of course
it would be possible to create a model of the system that represented the
complete unsaved state, including any pending refactorings, so that when you
saved the method it also applied all the refactoring changes. The RB's
existing model classes could be used to implement this I think. However I
suspect it might turn well turn out to be more complex to use that it is
worth - after all you'd lose much of the "immediacy" of the normal way of
working in Smalltalk, plus you'd have to deal with conflicts that might
arise from multiple editing sessions. It fails to pass the complexity filter
for me.
On the other hand there are some refactorings (extract temporary springs to
mind) that have only local effect, or which are typically benign (e.g.
adding an instance variable) and so obviously these could be performed quite
safely in an unsaved method. I had hoped to do something about this in X6,
but again it didn't make the cut. Actually that's not quite true, as some of
the auto-correct operations are refactorings, but it would be worth formally
recording as an enhancement request I think.
Regards
Blair