Category | Static | Dynamic |
---|---|---|
Strong | C,C++,Java, | Python, Ruby |
Weak | None | JavaScript, Perl |
In a dynamic type system objects types are only resolved at runtime.
def add(x, y):
print(x + y)
add(1, 2) # add int
add(10.1, 11.2) # add float
add("abc", "xyz")# add string
add([1, 2], [3, 4]) # add list
Common definition is that the language will not in general implicitly convert objects between types
Note: The exception being the conversion to bool used for if statements and while-loop predicates.