generic operations on different types