Interesting-looking paper that I haven't got around to reading yet: Type-safe cast does no harm , by Dimitrios Vytiniotis and Stephanie Weirich.