Go language
- In 2007, three technical experts wanted to design a new language with the goal of becoming the C language in the Internet and multi-core era.
- In mid-2008, the feature design of the language was completed, and work began on implementing the compiler and runtime. Russ Cos joined
- In 2009, Go began to gradually stabilize. In September of the same year, Go was officially released and open sourced.
Go's genetic map
- Concurrency features
It evolved from the CSP theory released by Hoare of Bell Labs in 1978.
The CSP concurrency model has been gradually improved in programming languages such as Squeak/Newsqueak and Alef, and is moving toward practical applications.
Erlang is another implementation of CSP theory.
- Object-oriented, packages, interfaces
The Pascal language designed by Niklaus Wirth, and related programming languages derived from it.
The concept of package, package import and declaration syntax, etc. mainly come from the Modula-2 programming language. The
declaration syntax of the methods provided by the object-oriented method comes from the Oberon programming language.
GO has developed its own unique implicit interface that supports duck object-oriented types and many other features.
- other
- iota is borrowed from the APL language
- Lexical scope, nested functions, from Scheme language
- Designed by myself
- Slicing: provides efficient random access for lightweight dynamic arrays
- defer
Hello World
B language
When Ken Thompson was young, he designed a general programming language called B language at Bell Labs to assist in the development of Unix systems.
//定义全局变量,设定要输出的内容
//每个变量的长度,必须对齐到4字节,和写汇编语言一样
a 'hell';
b 'o, w';
c 'orld';
//多次调用putchar函数输出字符
//!*n表示换行
main(){
extrn a,b,c;
putchar(a);putchar(b);putchar(c);
putchar('!*n');
}
Language B is simple, has limited functions, lacks flexible data types, and is difficult to use.
In order to provide rich types, Ken's colleague Dennis Ritchie developed the C language based on the B language and rewrote UNIX. So far, C language has become one of the commonly used programming languages.
C language
Early days
main(){
printf("hello, world")
}
/*
说明
1. main函数没有明确的返回值类型,默认为int类型
2. printf函数默认不需要导入函数声明即可使用
3. main没有明确返回语句,但默认返回0
*/
- Functions do not need to write return values
- Function parameters can be ignored
- There is no need to include header files when using printf
1978, "C Programming Language·1st Edition"
main(){
printf("hello, world\n")
}
Added line breaks, more !*n
concise than
1988, "C Programming Language·2nd Edition"