Static Typing:
A programming language is said to be statistically typed if
1. The variable type is known at compile time by data declaration. This means that we as a programmer must specify what type each variable is. Eg: C,C++, Java
2. The variable name is bound to an object.(optionl). If not it(the name) is said to be null
The advantage is that all kinds of checking can be done at compile time and a lot of stupid bugs can be caught at an early stage.However, it cannot be bound to an object of different type. Any attempt to bind the name to an object of the wrong type will raise an exception.
Dynamic Typing:
A programming language is said to be dynamically typed if
1. A variable name(unless it is null) is bound to only to an object. Names are bound to objects at execution time by means of assignment statements and it is possible to bind a name to objects of different types during the execution of the program. Eg: Python
Weak Typing:
In weak typing, variables can be implicitly coerced to unrelated types.Eg:
Strong Typing:
To coerce unrelated types, an explicit conversion is needed.
A programming language is said to be statistically typed if
1. The variable type is known at compile time by data declaration. This means that we as a programmer must specify what type each variable is. Eg: C,C++, Java
2. The variable name is bound to an object.(optionl). If not it(the name) is said to be null
The advantage is that all kinds of checking can be done at compile time and a lot of stupid bugs can be caught at an early stage.However, it cannot be bound to an object of different type. Any attempt to bind the name to an object of the wrong type will raise an exception.
Dynamic Typing:
A programming language is said to be dynamically typed if
1. A variable name(unless it is null) is bound to only to an object. Names are bound to objects at execution time by means of assignment statements and it is possible to bind a name to objects of different types during the execution of the program. Eg: Python
Weak Typing:
In weak typing, variables can be implicitly coerced to unrelated types.Eg:
a = 9 b = "9" c = concatenate(a, b) // produces "99"d = add(a, b) // produces 18
Strong Typing:
To coerce unrelated types, an explicit conversion is needed.
a = 9 b = "9" c = concatenate( str(a), b)d = add(a, int(b) )
No comments:
Post a Comment