Static vs Dynamic Typing
The cluster debates the merits of static typing for catching errors at compile time versus dynamic typing's runtime checks, focusing on safety, debugging, and bug prevention in programming languages.
Activity Over Time
Top Contributors
Keywords
Sample Comments
Your point doesn't make sense... you talk about the weakness of not being type checked, then say it's ok because that happens at runtime?
Could you explain how static typing makes less safe programs?
As compact. Most of type errors will shift to compile time, instead of blowing during runtime. Profit.
That not a bug that static typing would catch as it is not a type bug.
Runtime type checking while useful does not offer the same level of safety as compiler time. It will catch sinner classes of errors but you'll still have bugs lurking in production.
That may be for the static type system but you could still check and signal an error at runtime instead of silently ignoring it.
As opposed to some modern type system feature that would catch such bugs at compile time rather than let them happen at runtime.
I disagree. Other than the already mentioned points in replies, static typing and failing at compile time with a helpful error is really important. Runtime errors are much harder to interpret and debug - it is a skill they will have to learn later on, but inferring runtime state at a given point is arguably harder than doing so statically.
I don't think so. I think you're referring to static type checking. I'm referring to dynamic/runtime type checking.For instance, `1 + "hello"` will throw a `TypeError` at runtime because the `+` operator is not supported for use with `str` and `int` types. In a statically typed language, the code would not run or compile unless a `+` operator has been defined that takes a `str` type as it's first argument and an `int` type as it's second argument.I g
This is only true if the bug is caught by the runtime checker. Lots of type bugs aren't, especially in languages with type coercion.