Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Strong vs Static Typing AND Weak vs Dynamic Typing

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.

like image 496
Airon Zagarella Avatar asked Aug 09 '12 18:08

Airon Zagarella


People also ask

What is the difference between strong and weak typing?

Strong versus weak is about HOW SERIOUS DO YOU GET while checking the types. You can say that weak typing is relaxed typing, and strong typing is strict typing. Unlike dynamic vs static, the strength of the typing system is a spectrum. JavaScript has very weak typing.

What is the difference between static and dynamic typing?

Statically typed languages perform type checking at compile-time, while dynamically-typed languages perform type checking at run-time. Statically-typed languages require you to declare the data types of your variables before you use them, while dynamically-typed languages do not.

What is dynamically and strongly typed?

Strong typing means that variables do have a type and that the type matters when performing operations on a variable. Dynamic typing means that the type of the variable is determined only during runtime.

What is strong typing programming?

A strongly typed programming language is one in which each type of data, such as integers, characters, hexadecimals and packed decimals, is predefined as part of the programming language, and all constants or variables defined for a given program must be described with one of the data types.


1 Answers

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.

like image 190
Boumbles Avatar answered Sep 24 '22 10:09

Boumbles