The concepts of weak type, strong type, dynamic type, static type, interpreted type, compiled type, script, etc. of programming language

The concepts of weak type, strong type, dynamic type, static type, interpreted type, compiled type, script, etc. of programming language

In some of the technical documentation, programming books, describes the background of programming languages, development, design concept, often referred to these words: dynamic typing, static typing, strong typing, weak, interpreted, compiled, scripts and so on .

Such as: Python is a strongly typed dynamic scripting language.

【Strong Type: Different types are not allowed to be added together.

Dynamic: Do not use the display data declaration type, and determine the type of a variable when it is assigned a value for the first time.

Scripting language: It is generally an interpreted language. Only one interpreter is needed to run the code, and no compilation is required.

 

 

Strongly typed languages:

Once a variable is assigned a certain data type, if it does not undergo a coercion (re-assignment), then it will always be of this data type. For example, in Python, an integer variable a is defined, and different types are not allowed to be added. Integer + string will report a type error. Strongly typed languages ​​are type-safe languages.

 

Weakly typed languages :

Once a variable is assigned a data type, it does not need to be cast, and it is directly changed to another type language when using it. For example, the integer variable a=1 + "abc" in JavaScript will result in the string 1abc, and the type of a variable is determined by its application context.

 

[Strong type and weak type are mainly classified from the perspective of variable type processing. These concepts are not strictly defined. They are not inherent properties of the language, but the behavior of the compiler or interpreter. It is mainly used to describe the processing method of the programming language for the value mixed with different data types. A strongly typed language means that once a variable is bound to a certain type, no matter in the compiling stage or the running stage, the variable will hold that type and cannot be mixed with other types of expressions. The opposite is true for weak types.

 

Statically typed language:

It refers to a language in which the data type of a variable can be determined at compile time. Most statically typed languages ​​require that the data type must be declared before using the variable. Some modern languages ​​with type inference capabilities may be able to partially alleviate this requirement.

 

Dynamically typed language:

It is a language that determines the data type at runtime. No type declaration is required before the variable is used. Usually the type of the variable is the type of the value being assigned. For example, in python, the variable a=1, the type of a is an integer, and if a=”abc”, the type of a is a string.

 

[A process of verifying whether the type data and assignment meet the type requirements during type checking. When the compiler or interpreter does type checking at the compilation stage or at the runtime stage to define whether the programming language is a dynamic type or a static type. If the type checking of a programming language occurs in the "compile time" (Compile Time), it is defined as a "statically typed language".

 

Interpretive

The source code of the interpreted language will be converted into a computer executable file and executed by the language interpreter at the moment of execution. The entire running process will be continuously interpreted, executed; interpreted, executed... even if it is new Once run to the program that has been explained, the interpreter will still interpret and execute it again. For example: JavaScript, Python, etc. are all interpreted languages.

 

Compiled

It means that the source code of the language needs to be compiled by a compiler to generate an executable file or computer instruction for the computer (operating system) before it can be recognized by the computer and executed. The completion process is: the programmer writes the project source code according to the demand, and then the source code is handed over to the compiler to compile all the source files at one time to obtain the executable file, and then the executable file can be run through the operating system , You can see the actual running effect. For example: C, C++, C# and other languages ​​can be regarded as compiled languages.

 

Markup language

Markup Language is a computer text encoding that combines text and other information related to the text to show the details of document structure and data processing. Other information related to the text (including, for example, the structure and presentation information of the text, etc.) is combined with the original text, but marked with a markup. Such as: HTML, XML

 

Scripting language

The scripting language is a computer programming language created to shorten the traditional edit-compile-link-run process. .

A script is usually interpreted and run rather than compiled. Scripting languages ​​usually have simple, easy-to-learn, and easy-to-use features. The purpose is to allow programmers to quickly complete program writing. Such as: JavaScript, VBScript, PHP

 

Compiled language

Compiled language: Before the program is executed, a special compilation process is required. The program is compiled into a machine language file. It does not need to be re-translated during runtime, and the compiled result is used directly. The program execution efficiency is high, it depends on the compiler, and the cross-platform performance is poor. Such as C, C++.

 

Programming language

Also called "computer language", there are many types, generally speaking, it can be divided into three categories: machine language, assembly language, and high-level language. Every action and step performed by a computer is executed in accordance with a program that has been compiled in computer language. A program is a collection of instructions to be executed by the computer, and all programs are written in the language we master. Therefore, if people want to control a computer, they must issue commands to the computer through computer language. At present, there are two types of general programming languages: assembly language and high-level language.

 

[Compilation: Translate the source code of the text into machine instructions. This machine instruction can be interpreter, virtual machine-oriented (such as vb, java, python), or cpu-oriented (such as c), which is a compilation Periodic behavior, if you modify the code, you need to recompile, and you don’t need to repeat the compilation process if you don’t modify the code.

Interpretation: It is the conversion of text source code or machine instructions that are not directly understandable by the CPU into the CPU instruction set. This is a runtime behavior. Every time it is executed, an interpretation process is required.

The definition of Script language is established by convention. It is this language that is generally interpreted and executed, and is generally used for fast batch processing, so we call it a scripting language. Programming languages ​​and scripting languages ​​cross each other, and there is no clear boundary between the two. Scripts are usually saved as text (ASC), only to be interpreted or compiled when called.

 

Special reminder: With the development and evolution of language, the overlap of language features may not define the boundaries clearly. Different people may have different opinions from different angles. There is no need to hold rigid and mechanical concepts about this.

 

Regarding these, the following information is good, and a link is given for reference. 

Programming languages ​​are dumb and confused: weak type, strong type, dynamic type, static type  https://cloud.tencent.com/developer/article/1332131

The beauty of programming languages ​​is divided into interpretation and compilation in dynamic and static states, between strong and weak. https://segmentfault.com/a/1190000023108307

The meaning and comparison of markup language, scripting language and programming languagehttps:  //blog.csdn.net/ChinaGir/article/details/97886786

 

Guess you like

Origin blog.csdn.net/cnds123/article/details/115275931