I read about type system in wikipedia. There are three types in computer programming (strong, weak and latent). But I do not understand very well.
In general
Java (int a = 0), so java is strong type, because it has defined type(integer in this case)
php ($a = 0), php is weak type. because it does not have defined type
python (a = 0), Is it strong or weak? But wikipedia said that python is strong type.
I want to know more about typing discipline.

- 1,215
- 2
- 17
- 32
-
1Possible duplicate of [Is Python strongly typed?](http://stackoverflow.com/questions/11328920/is-python-strongly-typed) – TDG Mar 04 '17 at 10:03
-
@TDG I do not want to know about python. I want to know about typing discipline. – Nyein Chan Mar 04 '17 at 10:09
2 Answers
At the root, all computer variables are collections of bits. The question is how to know what the bits are and what they represent.
In a strongly typed language, you tell the compiler at the point the bits come into the program, and then that type "taints" them, it's impossible to assign them to a variable of another type except via special conversion operations. Also, at each point, you must say what type you are expecting.
In weakly-typed languages, the bits are also tagged, but instead of "tainting" the bits, it travels with them - usually because underlying the variable there are matric dimensions, type fields, structure member name fields, and so on. So you don't have to say what type you are expecting. You can have what is called duck typing. If the variable has a field called "quack", you can write "Quack += 1.0", and to all intents and purposes it's a duck, even if it was set up as a doctor.
Latently-type languages are ones where the values rather than the variables hold the type. S instead of saying
int x = 5;
You say x = 5; // x is an integer type
x = "five"; // x is a string type

- 6,258
- 1
- 17
- 18
The definition which you are trying to build is not correct. Strong type means not to define the type of variables explicitly before assigning any value but it is little bit different. It means that we may specify one type to a data but we can not use it as another type, so the type of a value doesn't change in unexpected ways. Every change of type requires an explicit conversion.

- 61
- 6