A couple of years, has contacted c / c ++, python, lua, dart, JavaScript, java variety of languages, record the understanding of a programming language
Understanding of a programming language, we should focus on two aspects
First, the language features
Language features include:
Type 1 strongly vs weakly typed
Strong type is the type of hard, do not accept converts
Such as c ++ is strongly typed, different types of conversion requires various cast
JavaScript is weakly typed, a variable, for a number, for a string, a target will not be a problem
2. static vs dynamic typing
Statically typed: Before running the program to determine the variable types, subject to prior declaration or deduced by the compiler
Dynamic type, until the program runs for type binding and checking
3. static vs dynamic languages language
Program at run time can change the code structure, such as a JavaScript object is added at any time to add a member or function
4. The value of the reference data types Type vs
JavaScript In addition to the basic data types, others are reference types, so in fact the variable assignment points to the same object
Summary: Whether you need to specify the type of variable declaration -> static vs dynamic typing
After the type of statement whether conversion -> strongly typed vs weak type
The program is running, can change the object's internal structure -> static vs dynamic languages language
However, all does not count for dart language
Both can be compiled into a binary, AOT, and can explain the run
Variable declaration can either specify the type, can also be dynamic statement does not specify the type of
Does not support the reflex, it is a static language
Type is not free conversion, is a strongly typed language
Second, the operating environment
Runtime environment is real or virtual machine operating system, there is need to pay attention
1. Compile and run vs interpreted
Compiled: Source -> Compiler -> executable code
Interpreted: read by the interpreter source code, compiled, and run.
Just with different source code into object code translation time.
c / c ++ is a compiled type, each of the source files are compiled into obj, after the connector link to the executable file, the operating system loads and executes
js, python is interpreted, compiled bytecode first, loaded by the virtual machine execution.
Pay attention to the compilation unit: c / c ++ file is the same, but the page is js code block (<script> split) units, nodejs and python independent translation, execution, but each block of code shared variables
2. Asynchronous Programming Model
nodejs asynchronous model is single-threaded, asynchronous callback model leads to hell problems arise after await, async, sync to programmatically write asynchronous code. Better maintenance
3. Garbage Collection
Understand, there is great hope that God may correct or supplement.