What Are the Different Types of Language Qualifications?
Strong and weak typing means that in computer science and programming, the type system of programming languages is often divided into two types : strongly typed (English: strongly typed) and weak types (English: weakly typed (loosely typed)). . These two terms are not very clearly defined, but they are mainly used to describe how the programming language handles the operation of mixing values of different data types. When a strongly typed language encounters a mismatch between the function argument type and the actual call type, it often makes an error or compilation fails; while a weakly typed language often implements implicit conversions or produces unexpected results. This pair of terms has already contained more meaning in the short history of computers, and it is often difficult to know what the person who wrote it meant.
- Programming language expert Benjamin C. Pierce, author of Types and Programming Languages and Advanced Topics in Types and Programming Languages, once said: "I spent a few weeks ... trying to figure out" strong typing "," static typing "," Safety, "and so on, but I find it unusually difficult ... these terms are used in different ways and are therefore almost useless."
- Broadly speaking, "strongly typed" implies that programming languages impose strict restrictions on the admissibility of mixed cases to prevent code from compiling or running with invalid data usage. For example, integer division cannot be used for strings; arithmetic steps on linked lists cannot be used for numbers. However, the nature and effectiveness of these restrictions can be easily changed.
- Some of the elements that have been identified as "strongly typed" by the author [1] include:
- Static typing is different from dynamic typing. In a static type system, a type is the name associated with a variable (usually at the time of declaration), not the value (usually at initialization). The type can also be inferred by the compiler.
- Hosting requirements for compile-time checks for type constraint violations through language definitions. That is, the compiler ensures that operations occur only on operands that are valid for this operation.
- Type safety; that is, deny (at either compile time or run time) an operation or function call that attempts to ignore the data type. In a more rigorous setting, the type safety of formal languages is proven by proving progress and hiding.
- Disable type conversion. Values of one type, whether explicit or implicit, cannot be converted to another type.
- But some authors reserve the term "strongly typed language" for languages that omit implicit type conversions (that is, conversions that the compiler inserts for the benefit of the programmer). For these authors, the programming language is strongly typed if the type must be converted by an explicit notation commonly called "coercion".
- No regulations avoid type system. Some languages allow programmers to get things under the representation of a value (that is, bit patterns), which may circumvent the type system.
- There are complex and detailed type systems for composite types.
- A fixed and immutable type in a data object. The type of a given data object does not change during the lifetime of this object. For example, class instances cannot change their class.
- Before running a program, strong typing guarantees program behavior during runtime, which is provided by static analysis or other mechanisms.