|
|
|
|
|
by yencabulator
16 days ago
|
|
Go is fine with pointer methods (comparable to Rust &mut self) on types that are structurally "primitives". (Go predeclared types do not have methods.) package main
import "fmt"
type T int32
func (t *T) inc() { *t = *t + 1 }
func main() {
var t T = 42
t.inc()
fmt.Println(t)
}
|
|