You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+13-2
Original file line number
Diff line number
Diff line change
@@ -46,13 +46,13 @@ For more details, see [Quick Start](doc/docs.md).
46
46
47
47
## Key Features of Go+
48
48
49
-
* Approaching natural language expression and intuitive (see [Command Style Code](#command-style-code)).
49
+
* Approaching natural language expression and intuitive (see [How Go+ simplifies Go's expressions](#how-go-simplifies-gos-expressions)).
50
50
* Fully compatible with [Go](https://github.com/golang/go) and can mix Go/Go+ code in the same package (see [Go/Go+ Hybrid Programming](doc/docs.md#gogo-hybrid-programming)).
51
51
* Integrating with the C ecosystem including Python and providing limitless possibilities based on [LLGo](https://github.com/goplus/llgo) (see [Support for C/C++ and Python](#support-for-cc-and-python)).
52
52
* Does not support DSL (Domain-Specific Languages), but supports SDF (Specific Domain Friendliness) (see [Go+ Classfiles](#go-classfiles)).
53
53
54
54
55
-
## Command Style Code
55
+
## How Go+ simplifies Go's expressions
56
56
57
57
Different from the function call style of most languages, Go+ recommends command style code:
58
58
@@ -68,6 +68,17 @@ echo "Hello world"
68
68
69
69
For more discussion on coding style, see https://tutorial.goplus.org/hello-world.
70
70
71
+
Code style is just the first step. We have made many efforts to make the code more intuitive and closer to natural language expression. These include:
72
+
73
+
| Go code | Go+ code | Note |
74
+
| ---- | ---- | ---- |
75
+
| package main<br><br>import "fmt"<br><br>func main() {<br> fmt.Println("Hello world")<br>} | import "fmt"<br><br>fmt.Println("Hello world")<br> | Program Structure: Go+ allows omitting `package main` and `func main`. The contents of the main function can be written directly at the end of a Go+ file. |
76
+
| fmt.Println("Hello world") | echo("Hello world") | Go+ provides more builtin functions to simplify the expression of the most common tasks. |
77
+
| fmt.Println("Hello world") | echo "Hello world" | Go+ encourages writing code in a command-line style. It reduces the number of parentheses in the code as much as possible, making it closer to natural language. |
78
+
| a := []int{1, 2, 3} | a := [1, 2, 3]| List literals |
79
+
| a := map[string]int{<br> "Monday": 1,<br> "Tuesday": 2,<br>} | a := {<br> "Monday": 1,<br> "Tuesday": 2,<br>} | Mapping literals |
0 commit comments