Re: [go-nuts] Should the program print true or false?

2020-09-17 Thread Marvin Renich
* 'Axel Wagner' via golang-nuts [200917 12:05]: > I think you might've intended this, which does indeed print true: > type S []S > var a, b S > a, b = S{0: b}, S{0: a} > fmt.Println(reflect.DeepEqual(a, b)) I was guessing he meant: type S []S var a, b S a = S{0: b} b = S{0: a}

Re: [go-nuts] Should the program print true or false?

2020-09-17 Thread tapi...@gmail.com
Aha, you are totally right. I made silly mistake here. ;D On Thursday, September 17, 2020 at 12:05:31 PM UTC-4 axel.wa...@googlemail.com wrote: > I think you might've intended this, which does indeed print true: > type S []S > var a, b S > a, b = S{0: b}, S{0: a} > fmt.Println(reflect.DeepEqua

Re: [go-nuts] Should the program print true or false?

2020-09-17 Thread tapi...@gmail.com
Aha, you are totally wrong. I made silly mistake here. ;D On Thursday, September 17, 2020 at 12:05:31 PM UTC-4 axel.wa...@googlemail.com wrote: > I think you might've intended this, which does indeed print true: > type S []S > var a, b S > a, b = S{0: b}, S{0: a} > fmt.Println(reflect.DeepEqual

Re: [go-nuts] Should the program print true or false?

2020-09-17 Thread 'Axel Wagner' via golang-nuts
I think you might've intended this, which does indeed print true: type S []S var a, b S a, b = S{0: b}, S{0: a} fmt.Println(reflect.DeepEqual(a, b)) On Thu, Sep 17, 2020 at 6:03 PM Axel Wagner wrote: > I don't think the docs imply that. For one, a[0] is nil, and b[0] isn't. > > On Thu, Sep 17,

Re: [go-nuts] Should the program print true or false?

2020-09-17 Thread 'Axel Wagner' via golang-nuts
I don't think the docs imply that. For one, a[0] is nil, and b[0] isn't. On Thu, Sep 17, 2020 at 5:58 PM tapi...@gmail.com wrote: > > package main > > import ( > "fmt" > "reflect" > ) > > func main() { > f() > } > > func f() { > type S []S > var a, b S > a = S{0: b} > b = S{0: a} >

[go-nuts] Should the program print true or false?

2020-09-17 Thread tapi...@gmail.com
package main import ( "fmt" "reflect" ) func main() { f() } func f() { type S []S var a, b S a = S{0: b} b = S{0: a} fmt.Println(reflect.DeepEqual(a, b)) } Now it prints false. But it looks the docs indicates it should print true. -- You received this message because you are