Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Created by
brew bump
Created with
brew bump-formula-pr
.release notes
libraries:
features:
changes:
deps:
ci & tools:
Important Updates in v1.3 (vs. v1.2)
Documentation:
Improved Go+ Mini Spec documentation. Go+ Mini Spec is a carefully designed language specification that represents the essence of Go+: providing a minimal but Turing-complete syntax set, while also representing the best practices of Go+ programming.
Auto-generated documentation for Go+ builtin functions. Go+'s builtin functions are far more extensive than Go's, which simplifies the expression of common tasks. Additionally, Go+'s basic types also have methods. For example, the
string
type has built-in common string operations. Among them,"123".int
converts a string to an integer type;"get_table_name".split("_")
splits a string into a list["get", "table", "name"]
.Language Features:
Goodbye to
append
, new syntax for adding elements to a list: the<-
operator. The familiara = append(a, v1, v2, ..., vN)
for Go programmers now becomes the more intuitivea <- v1, v2, ..., vN
. Connecting two lists is similar: previouslya = append(a, b...)
, nowa <- b...
.Introduced
for .. in
to replace the previousfor .. <-
, making it more consistent with mainstream languages. The oldfor .. <-
will still be supported, but after formatting the code with gop fmt, it will automatically convert<-
toin
.Introduced numeric literals with units, such as
1s
for 1 second. This allows us to usewait 0.5s
instead of the previously verbosewait 0.5*time.Second
, making the semantics more intuitive. It's worth noting that the meaning of numeric constants with units varies depending on the type of data. For example, inwait 1m
, because the parameter is a time type,1m
means 1 minute. Instep 1m
, where the parameter type is distance,1m
means 1 meter.Support for users to choose their own Go compiler, which can be specified in go.mod. Go+ currently supports the following Go compilers:
go
(Go's official compiler),llgo
(maintained by the Go+ team), andtinygo
(a Go compiler specifically for embedded environments). Currently, Go+ defaults to usinggo
, but will default tollgo
in the future. To initialize a module usingllgo
, simply execute the commandgop mod init -llgo mymodule
.Support for importing C/C++ and Python libraries. Go+'s support for importing C/C++ and Python libraries is achieved through LLGo. Currently, the support for C/C++ libraries is quite mature, and we will provide automated tools to cover mainstream C/C++ libraries, eliminating the need for users to manually migrate C/C++ libraries to the Go world as with cgo. Go+'s support for Python libraries is still experimental and will be a focus in future versions of Go+.
Wasm support. Go+'s support for Wasm is achieved through LLGo. Wasm generated by LLGo will be smaller in size than Wasm compiled by the official Go compiler, and it still supports generating Wasm files when using cgo (the official Go compiler doesn't support Wasm when using cgo).
Built-in clone support for classfiles, making object cloning operations more efficient. Possible application scenarios: creating Handler instances for each new connection in a web framework. Before clone support, we typically needed to implement object cloning through the reflect mechanism, which not only made the code obscure but also introduced significant performance overhead.
Support for Domain Text Literals.
Built-in Functions:
Added the built-in function
type
as a replacement forreflect.TypeOf
, used to view the type of an object.Added the Capitalize method to string and []string types, used to capitalize the first letter of a string. For example:
"hello".capitalize
will result in the string"Hello"
, and["hello", "world", "!"].capitalize
will result in["Hello", "World", "!"]
. Converting a C-style variablex := "get_table_name"
to camel case"GetTableName"
only requiresx.split("_").capitalize.join("")
.Standard Libraries:
yacc
andbison
. However, it's not a standalone tool but a domain text literal embedded in the Go+ language.Full Changelog: goplus/gop@v1.3.8...v1.3.9