Dynamic vs Static Typed
Dynamically Typed Languages
In dynamically typed languages, the type of a variable is determined at runtime, allowing more flexibility but potentially leading to runtime errors.
Characteristics:
- Types are inferred automatically.
- Errors related to types are caught at runtime.
- Great for rapid prototyping and scripting tasks.
Statically Typed Languages
In statically typed languages, the type of a variable is determined at compile-time, providing better performance and error detection before execution.
| Type System | Characteristics | Examples |
|---|---|---|
| Dynamically Typed | Runtime type checking, flexible but riskier | Python, JavaScript, Ruby |
| Statically Typed | Compile-time type checking, safer but stricter | Java, C, Rust, Go |
| Mixed | Allows both static and dynamic typing | TypeScript, Dart, Python (with hints) |