Use a data-driven dispatcher for simple type conversion.

Articulating the design suggestion I made on a8d7b04.