Thread local & portable dependency injection

This is a pattern I knocked together to address the issue of global mutable state in the F# compiler.