|
|
|
|
|
by AQXt
1963 days ago
|
|
> What thing that violates a type check would be "perfectly fine to do"? A typical example, in dynamic programming languages, is to treat numbers as strings and vice-versa; evaluate lists in boolean context; and so on. > If value is not a numeric type, square is not going to be happy. And that's the case with most (all?) dynamic code. Some programming languages will be glad to accept a string and treat it as a number -- see Duck Typing (https://en.wikipedia.org/wiki/Duck_typing). |
|
That sounds great until it bites you in the ass really hard. In general, you want to catch unintended behavior as early as possible.