GOXXLANG

WASM-first IDL

Write Go. The program is C++.

Go++ is the language. wasigoc is the compiler. You write Go, and wasigoc lowers that source to one C++ translation unit. That C++ is the program the module runs.

Try Go++ wasigoc on GitHub

01

The IDL

The surface is Go: packages, functions, slices, maps, goroutines, channels, and defer. That source is the interface of the program.

02

wasigoc

wasigoc is the compiler. It reads the Go++ and emits C++. Integers become long long. fmt.Println becomes a stream write. main stays main.

03

The module

The emitted C++ is the wasm program: Oilpan collection, cooperative goroutines, one linear memory, and the Win32, Nix, and Android catalogs inside the module.

Try Go++

Edit a program and run it. wasigoc lowers the source, and this edge runs the C++ it just emitted. The panel under the output is that C++.

Go++
Program

        
C++ from wasigoc

      

What the lowering keeps

wasigoc keeps the shape of the Go++ and spells each construct as the C++ that belongs in the module.

Go++C++
func / mainA C++ function. int is long long.
goroutinewasigo::Task, a cooperative coroutine on one run queue.
chanwasigo::Chan<T>
deferRAII. Destructors run in LIFO order.
[]Twasigo::Slice<T>
map[K]Vwasigo::Map<K,V>
interfaceA generated vtable.
GCOilpan. Precise trace, stop the world, inside the module.
package main

import "fmt"

func main() {
	fmt.Println("hello, goxxlang")
}