What is the difference between the concept of static and dynamic typing and the concept of strongly and weakly typed? [duplicate]

6

There is some confusion about the concept of programming languages with static and dynamic typing and the concept of strongly and poorly typed programming languages.

For example, by my understanding Python is a dynamic typed language, since I can assign any value a variable ( x in the example):

>>> x = 1
>>> x = "teste"
>>>

However, Python is also a strongly typed language because I can not do something like:

>>> x = "0"
>>> x += 1
Traceback <most recent call last>:
   File "<stdin>", line 1, in <module>
TypeError: Can't covert 'int' object to str implicitly

Could someone explain me this better?

    
asked by anonymous 06.11.2015 / 15:38

1 answer

3

Liskov and Zilles defined strongly typed languages as those where an object, when passed from one function to another, must have a type compatible with that declared in the function that receives the object.

Static languages are language that have static typing, where the type of a variable can not change. A static language is not necessarily strong typing where the non type can be interpreted in different ways.

In C, for example, which is static language, we can interpret a given data in a memory region in different ways when we use pointers.

    
06.11.2015 / 16:23