|
|
|
|
|
by mapcars
665 days ago
|
|
I want my types to be verified before runtime, what should I do with type error at runtime? Yes it will leave me a better error message in logs, but build-time type check will prevent me even rolling this code out. So yes, its categorically better. |
|
It is weird to me you cannot think of uses for types and handling their errors at runtime. Look at projects like FastAPI (which uses pydantic) for an an example where having types at runtime has been handy.
Also, if types are enforced at runtime logging is better, debugging is better, and you have more options for data validation and doing dynamic or metaprogramming likely more easily because you can evaluate these things at runtime. By types being built in, the language gives you a richer set of tools to work with and more options when and how to enforce types.