Re: [go-nuts] Experience report on a large Python-to-Go translation

2020-01-29 Thread Nigel Tao
On Wed, Jan 29, 2020 at 11:05 PM Axel Wagner wrote: > On Wed, Jan 29, 2020 at 12:57 PM Nigel Tao wrote: >> For example, the https://golang.org/pkg/io/#LimitedReader struct just >> exports its fields, and you use it like this >> (https://go.googlesource.com/go/+/refs/heads/master/src/io/io_test.go

Re: [go-nuts] Experience report on a large Python-to-Go translation

2020-01-29 Thread 'Axel Wagner' via golang-nuts
On Wed, Jan 29, 2020 at 12:57 PM Nigel Tao wrote: > For example, the https://golang.org/pkg/io/#LimitedReader struct just > exports its fields, and you use it like this > (https://go.googlesource.com/go/+/refs/heads/master/src/io/io_test.go#39). > There is no io.NewLimitedReader function. > Nit:

Re: [go-nuts] Experience report on a large Python-to-Go translation

2020-01-29 Thread Nigel Tao
Great write-up. > Keyword arguments should be added to the language. In idiomatic Go, we often use struct literals (together with "make the zero value useful", e.g. allocate map-typed fields lazily) instead of object-creation functions: x := &FooBar{ A: a, B: b.c(), } instead of x = newFo

Re: [go-nuts] Experience report on a large Python-to-Go translation

2020-01-26 Thread robert engels
Didn’t mean to imply anything negative - you accomplished what you set out to do. I “think in Java” and a lot of my initial problems with Go revolved around that, but even after doing some serious Go development - in the Go style - I can agree with many of your points. I will admit my bias agai