Coming from Go
Side-by-side comparisons for Go developers.
Variables
go
// Go
name := "Alice"
var age int = 30
const PI = 3.14wyn
// Wyn
var name = "Alice"
var age: int = 30
const PI = 3.14Functions
go
// Go
func add(a, b int) int {
return a + b
}wyn
// Wyn
fn add(a: int, b: int) -> int {
return a + b
}Error Handling
go
// Go
result, err := doSomething()
if err != nil {
return err
}wyn
// Wyn
var result = doSomething()
match result {
Ok(v) => println("${v}")
Err(e) => println("error: " + e)
}Goroutines vs Spawn
go
// Go
go func() {
result := heavyWork()
ch <- result
}()
val := <-chwyn
// Wyn
var future = spawn heavyWork()
var val = await futureChannels
go
// Go
ch := make(chan int, 10)
ch <- 42
val := <-chwyn
// Wyn
var ch = Task.channel(10)
Task.send(ch, 42)
var val = Task.recv(ch)Structs & Methods
go
// Go
type Point struct {
X, Y int
}
func (p Point) Distance(other Point) float64 {
dx := float64(other.X - p.X)
dy := float64(other.Y - p.Y)
return math.Sqrt(dx*dx + dy*dy)
}wyn
// Wyn
struct Point {
x: int
y: int
fn distance(self, other: Point) -> float {
var dx = (other.x - self.x) * (other.x - self.x)
var dy = (other.y - self.y) * (other.y - self.y)
return Math.sqrt(dx + dy)
}
}Pattern Matching (vs switch)
go
// Go
switch n {
case 0:
fmt.Println("zero")
case 1:
fmt.Println("one")
default:
fmt.Println("other")
}wyn
// Wyn
match n {
0 => println("zero")
1 => println("one")
_ => println("other")
}Pipe Operator (no Go equivalent)
wyn
// Wyn — no equivalent in Go
fn double(x: int) -> int { return x * 2 }
fn add1(x: int) -> int { return x + 1 }
var result = 5 |> add1 |> double // 12Performance Comparison
| Benchmark | Wyn | Go 1.24 |
|---|---|---|
| fib(35) | ~48ms | ~57ms |
| spawn 1M | ~247ms / 2MB | ~279ms / 12MB |
| binary size | 32KB | 2.3MB |
| compile time | ~260ms | ~500ms |
Key Differences
| Feature | Go | Wyn |
|---|---|---|
| Compilation | Go compiler | C backend (TCC/gcc) |
| Concurrency | Goroutines | Green threads (same M:N model) |
| Memory | GC | Arena allocator |
| Generics | Yes (1.18+) | Basic (monomorphization) |
| Error handling | error interface | Result type + match |
| Package manager | go mod | wyn pkg |