Confessions of a C# Hack
I've been making a lot of changes lately to the c# compiler. You won't see these in Whidbey so don't ask me about them yet. For the most part, it hasn't been too tough. The compiler was designed well and is generally easy to make modifications too. Yet eventually I hit a wall trying to get the compiler to do something it was not designed to do. That's when thoughts start racing through my head, “if I had designed this I would have done it differently; yada yada yada.“ I start imagining what it would be like if I actually did re-architect the whole thing. After all, I'm used to throwing out my own code and starting over. I do it all the time. But something is different when you are working on an established codebase. Especially, if it has already shipped.
In truth, the changes would probably be overwhelming and the impact on the product too huge to consider. The prudent thing to do would be to find a way to wedge the new behavior in. That's what I've been doing, and its often not pretty. I get rather flippant sometimes and refer to these changes as 'hacks', though that usually carries an extreme negative connotation, which is not really the truth. It is just my own dissatisfaction showing through, not want to let go of the dream of the perfect design.
At least I console myself with the thought that if we do one day embark on the mission to rewrite the compiler from scratch, I will have learned a lot about how the new compiler should be designed.