Difference between Strong vs Static Typing AND Weak vs Dynamic Typing
Asked Answered
S

1

50

From what I understand, dynamic typing is the same as weak typing and strong typing is the same as static typing, but I'm not sure I'm correct.

Swayder answered 9/8, 2012 at 18:20 Comment(2)
possible duplicate of Static/Dynamic vs Strong/WeakSequela
Does this answer your question? Static/Dynamic vs Strong/WeakEllord
N
87

Static typing vs dynamic typing:

Static typing is when your type checking occurs at compile time. You must define a type for your variables inside of your code and any operations you perform on your data would be checked by the compiler.

Dynamic typing is when your type checking occurs at runtime. Instead of errors coming up when you compile your code you will get runtime errors if you try performing operations on incompatible types. However, you will get the benefit of having more versatile functions as they can be written once for multiple data types.

Strong typing vs weak typing:

When you have strong typing, you will only be allowed operations on the data by direct manipulation of the objects of that data type.

Weak typing allows you to operate on data without considering its type. Some language do this through pointers. Other languages will convert one of your types to the other before performing the operations.

The links I included have a bit more detailed (and probably clearer) explanations.

Noisette answered 9/8, 2012 at 18:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.