Re: [go-nuts] []T(nil) vs []T {}

2017-08-20 Thread Matt Harden
The first one is a type conversion, not the second. On Thu, Aug 17, 2017, 14:59 Soumya Mukherjee wrote: > Thank you both. I did not realize the latter syntax is that of a type > conversion. > > On Thursday, August 17, 2017 at 1:43:45 PM UTC-4, Axel Wagner wrote: >> >> >> >> On Thu, Aug 17, 2017

Re: [go-nuts] []T(nil) vs []T {}

2017-08-17 Thread Soumya Mukherjee
Thank you both. I did not realize the latter syntax is that of a type conversion. On Thursday, August 17, 2017 at 1:43:45 PM UTC-4, Axel Wagner wrote: > > > > On Thu, Aug 17, 2017 at 6:09 PM, Soumya Mukherjee > wrote: > >> I am new to Golang. What is/are the difference(s) between the following

Re: [go-nuts] []T(nil) vs []T {}

2017-08-17 Thread 'Axel Wagner' via golang-nuts
On Thu, Aug 17, 2017 at 6:09 PM, Soumya Mukherjee wrote: > I am new to Golang. What is/are the difference(s) between the following > declarations? > > []T(nil) > > and > > []T {} > > Both seem to work identically for me. > https://play.golang.org/p/g6EFru8hUU Literally the only difference. > A

Re: [go-nuts] []T(nil) vs []T {}

2017-08-17 Thread Jan Mercl
On Thu, Aug 17, 2017 at 6:46 PM Soumya Mukherjee wrote: > What is/are the difference(s) between the following declarations? No declarations, both are expressions. > []T(nil) Type conversion. > []T {} Compound literal. > Both seem to work identically for me. They're not the same: https://pl