Re: [go-nuts] Question - type assertion x.(*T)

2016-06-28 Thread Jan Mercl
On Tue, Jun 28, 2016 at 11:13 AM Michael Wain wrote: > Why would I use *T over just T ? Consider this program package main import ( "fmt" ) type T int func main() { var a, b T = 42, 314

Re: [go-nuts] Question - type assertion x.(*T)

2016-06-28 Thread Michael Wain
Why would I use *T over just T ? Michael > On 28 Jun 2016, at 10:05, Jan Mercl <0xj...@gmail.com> wrote: > > On Tue, Jun 28, 2016 at 11:02 AM Michael Wain > wrote: > > > So a := x.(*T) is the same as a := x.(T) ? > > No, because T and *T are distinct types. > >

Re: [go-nuts] Question - type assertion x.(*T)

2016-06-28 Thread Michael Wain
So a := x.(*T) is the same as a := x.(T) ? Michael > On 27 Jun 2016, at 23:33, Axel Wagner wrote: > > Hm? It's this syntax: > https://golang.org/ref/spec#Type_assertions > using *T as the type. > >> On Mon, Jun 27, 2016 at 11:08 PM,

[go-nuts] Question - type assertion x.(*T)

2016-06-27 Thread michaelwain1990
Hi, Reading through gaoling spec regarding type assertions, in some code I've see type assertions like: a := x.(*T) i don't see a mention of that syntax in the spec, what is it doing? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To