Golang language features
The introduction
Learning a language begins with a brief understanding of the new language’s features, or features, and even comparisons with other languages, such as Java
features
Here, a simple comparison of Golang’s characteristics with Java’s makes it easier to observe. The table is as follows:
Feature item | Golang | Java |
---|---|---|
Dynamic and static characteristics | Static language that supports dynamic typing at run time | Static language |
Strong and weak characteristics | Strongly typed | Strongly typed |
Implicit type inference | support | Does not support |
Type safety | is | is |
Object-oriented support | Type combination support Supports object orientation | Class/interface |
interface | Duck model | According to declaration |
polymorphism | Support through interfaces | Interface and inheritance support |
The generic | Currently not supported, supported in later versions | support |
reflection | support | support |
Compilation model | Compile into an executable program | Compile to intermediate bytecode |
The operation mode | Run directly | Vm Running |
Memory management | Support for automatic garbage collection | Support for automatic garbage collection |
Concurrency support | coroutines | Java thread |
cross-platform | support | Native cross-platform |
conclusion
Programming language learning can also be summarized into two processes:
- Try to make use of the already mastered programming language, compare the grammar of the new language with that of the already mastered language, sort out the similarities and differences, establish connections between knowledge, so as to quickly master the grammar of the new language.
- Compared with old and new languages in terms of language features, new languages generally only have new syntax. Most languages have similar features with minor differences, and language features are universal.
Reference:
- Go language core programming
Update go-Notes regularly