>From a language user's point of view, the following understanding seems to
work:
- A named ("defined") type has one or more names ("identifiers")
- A type definition creates a new named type, distinct from all others
- An alias declaration adds a new name to an existing type
This does beg the question:
type Foo int
type Bar = Foo
var a Bar
What is the type of 'a'? Is it "Bar", or is it
"the-type-known-as-Foo-or-Bar"? What type should error messages show?
Testing shows that the type of a "Foo":
https://play.golang.org/p/fVpDaEN0OVG
So my simple understanding seems sufficient, at least in this simple case.
Error messages just show the first of the (perhaps many) names that the
type has.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/21dc75e9-ffbd-481c-ae1b-8d8662937d2a%40googlegroups.com.