Do typechecking on arguments.

No errors are thrown, but functions will return nil and an error message if invalid arguments are given. Use assert to force errors.