So doing *type X Y* is just a type declaration then? Meanwhile, I wrote a small example to help me figure out the differences between some of these based on the specs. Leaving it here in case it is useful for somebody.
package main import "fmt" type X struct {} func (X) f() {} type Y X // cannot call functions on X via Y type Z = X // alias declaration. identical types. func main() { x := X{} y := Y{} z := Z{} fmt.Println(x, y, z) x.f() z.f() // y.f() // not possible } On Tuesday, 13 August 2019 11:19:51 UTC+5:30, Volker Dobler wrote: > > type X Y declares a named type X with underlying type Y. > A type alias is something completely different (look up > "Alias declaration" in the Spec). > > There are no such things like "type redefinition" or > "type adapter" in Go. See the Spec again: It contains > neither. So the main difference between a type alias and > the other two is: The other two do not exist. > > V. > > On Tuesday, 13 August 2019 06:53:20 UTC+2, Sathish VJ wrote: >> >> And what is the difference between each of these: type alias, type >> redefinition, type adapter. >> > -- 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 golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/273b9d33-97f4-4946-9cb9-b92fe5ee769f%40googlegroups.com.