rich type system
simplify the code