Introducing type barriers for common cast functions