The Go+ programming language is designed for engineering, STEM education, and data science
new features:
changes:
gop_autogen.go
import style (#1489 https://github.com/goplus/gox/pull/293)new features:
gop go
in single file mode & check mode (#1453 #1456 #1463)github actions:
drafts:
changes:
new features:
changes:
incompatible changes:
new features:
changes:
new features:
changes:
! (Not)
expr (#1361)new features:
changes:
documentations:
changes:
First, it introduces the github.com/goplus/mod module. This module provides support for Go/Go+ module related capabilities. It can be thought of as enhancements to golang.org/x/mod which include:
Second, it has improved gop mod
(module management) related commands, especially the gop mod tidy
command needs to be considered in many cases.
Third, it enhances the completeness of gop
command functions such as gop build/install/run/test
, which are mainly reflected in:
gop run
local directories or files, now gop run
is supported to run a remote package.gop build/install/run/test
. Previously, the codes of gop run
and gop build/install
were written separately, lacking a unified support framework, and their behaviors would be different. Now they are unified into the same implementation framework.Fourth, it adds some syntax features that v1.0 does not have. This mainly includes:
++
, --
operators is supported.type()
is supported to represent the zero value of type type
. For example, string()
is equivalent to ""
, int32()
is equivalent to int32(0)
, and so on.uint128
, int128
types.any
type, which is equivalent to the empty interface.Fifth, it adds support for comment instructions in structure and function headers. E.g:
//go:notinheap
type S struct{ x int }
//go:noinline
//go:uintptrescapes
func test(s string, p, q uintptr, rest ...uintptr) int {
...
}
Of course, the comment instruction still needs to be further improved. For example, conditional compilation instructions, etc., are currently not implemented.
Sixth, fix many bugs. It includes Go+ bugs (issue #888, #1056, #1228, #1243, etc.) and new test cases have been added in go1.8 version, which may not all pass in Go+ v1.0 version (issues #1195, #1196, #1197, #1198, etc.).
Seventh, it supports Go/Go+ hybrid projects. For details, please refer to the gop/testdata/mixgo example. The following is an introduction to this in the project's README file:
Eighth, support for calling C from Go+. This includes:
gop c
command (equivalent to the stand-alone c2go
command) can be used to convert a C project to a Go project.import "C"
and import "C/xxx"
are used to import a C project converted by c2go. where import "C"
is short for import "C/github.com/goplus/libc"
.C"xxx"
syntax represents C-style string constants.Here is an example to show how Go+ interacts with C.
import "C"
C.printf C"Hello, c2go!\n"
C.fprintf C.stderr, C"Hi, %7.1f\n", 3.14
In this example we call two C standard functions printf
and fprintf
, passing a C variable stderr
and two C strings in the form of C"xxx"
(a Go+ syntax to represent C-style strings).
Run gop run .
to see the output of this example:
Hello, c2go!
Hi, 3.1
Of course, the current Go+ support for C is only a preview version, not to the extent that it is actually available in engineering. As far as libc is concerned, the current migration progress is only about 5%, and it is just the beginning.
In the upcoming Go+ v1.2 version planning, complete support for C is listed as a top priority. Of course, support for cgo and Go templates is also under planning, which is a crucial capability enhancement for Go/Go+ hybrid projects.
new features:
changes:
new features:
changes:
incompatible changes: