Hacker News new | ask | show | jobs
by masklinn 1892 days ago
> Would it be possible to change the Go compiler such that 3 has a type? (I'm guessing no, at least not easily, otherwise he'd be suggesting it, but I'm curious about the reason)

Why not? In fact it already kind-of does: Go has "default types" for most untyped constants. When you write

    i := 3
absent an explicit type, Go will fall back to "int".