> Go's confusion between "type aliases" and "newtypes". The only way to make a newtype in go is to make a separate package with an opaque type and use interfaces for indirection, which is costly and awkward. It's very unclear what this is supposed to mean. 'type Foo int' in Go creates a new 'Foo' type that can't be used as an int without casting (a̶l̶t̶h̶o̶u̶g̶h̶ ̶y̶o̶u̶ ̶c̶a̶n̶ ̶a̶s̶s̶i̶g̶n̶ ̶a̶n̶ ̶i̶n̶t̶ ̶t̶o̶ ̶i̶t…
You can't, in fact:
type Foo int
func main() {
var foo Foo = 1
var bar int = 2
foo = bar // cannot use bar (variable of type int) as Foo value in assignment
}
The reason you can do things like: var foo Foo = 1
is that because numeric literals in Go are not ints, they are untyped [0].