refactored SelectChanges.lhs

Posted on 6 March 2006
Tags:

I'm probably being a little quick to judge here, but the function with_any_selected_change in SelectChanges.lhs is some serious spaghetti. I'll bet it started out all nice and simple, and we just kept adding functionality to it one tiny feature at time, and us the darcs developers being so used to the code, never noticing that things were getting out of hand.

It took my all Sunday staring at it, making notes on the wiki, and finally tearing it to pieces and putting it back together (just rearranging code) to get a clearer picture what it was doing. I hope my refactor is correct, that it doesn't introduce any weird bugs into the code. One thing I'm slighly worried about is that I took out seemingly pointless seq, something that looks like other_ps `seq` ps' where, if I understand correctly, other_ps is defined to be []. Anyway, so I seperated the notion of counting patches from that of simply deciding which patches to consider. This way I can reuse the latter function in the gui selector. The code compiles. I only hope it does what it's supposed to.

Navigation

Comments