A little language inspired by Rust that compiles to Go
A little language inspired by Rust that compiles to Go
Little language inspired by Rust that compiles to Go.
Safe and expressive:
|> operator and try blocksQuietly practical:
Enums and pattern matching:
enum Shape {
Circle(float64),
Rectangle { width: float64, height: float64 },
}
fn area(shape: Shape) -> float64 {
match shape {
Circle(r) => 3.14 * r * r,
Rectangle { width, height } => width * height,
}
}
Go interop and ? for error handling:
import "go:os"
import "go:encoding/json"
import "go:fmt"
fn load_config(path: string) -> Result<Cfg, error> {
let data = os.ReadFile(path)?
let mut config = Cfg { port: 8080, debug: false }
json.Unmarshal(data, &config)?
Ok(config)
}
fn main() {
match load_config("app.json") {
Ok(config) => start(config),
Err(e) => fmt.Println("error:", e),
}
}
Option instead of nil and zero values:
match flag.Lookup("verbose") {
Some(f) => fmt.Println(f.DefValue),
None => fmt.Println("no such flag"),
}
let scores = Map.new<string, int>()
match scores.get("alice") {
Some(score) => fmt.Println(score),
None => fmt.Println("score not found"),
}
Pipeline operator:
let slug = " Hello World "
|> strings.TrimSpace
|> strings.ToLower
|> strings.ReplaceAll(" ", "-") // "hello-world"
Typed channels and concurrent tasks:
let (tx, rx) = Channel.new<string>().split()
task {
tx.send("hello")
tx.close()
}
match rx.receive() {
Some(msg) => fmt.Println(msg),
None => fmt.Println("closed"),
}
© 2026 Iván Ovejero