Re: [go-nuts] Add comparisons to all types

2022-05-04 Thread Jan Mercl
On Wed, May 4, 2022 at 10:10 PM Ian Lance Taylor wrote: > I can only give some personal opinions. Others will disagree. And my > opinions change over time, and could well be mistaken. > > I think that deciding that := declares a single variable in a > for/range statement was a mistake (https://

Re: [go-nuts] Re: Windows Binaries and stdout

2022-05-04 Thread stephen.t....@gmail.com
The blog is very interesting. However, I can't see how to re-implement this in Go with only the syscall package or the golang.org/x/sys/windows package. It needs the functionality of C++ freopen(), which as far as I can tell is not possible with the WinAPI - From what I can gather, ReOpen() on

Re: [go-nuts] Re: Windows Binaries and stdout

2022-05-04 Thread stephen.t....@gmail.com
Yes. Logging to a file is probably the simplest option for this particular use case. On Monday, May 2, 2022 at 2:27:22 PM UTC+1 anderson...@elastic.co wrote: > You could log to a file. If you're willing to take in a -log flag, you > could take a path as well and log to this file. That way you do

Re: [go-nuts] Add comparisons to all types

2022-05-04 Thread Ian Lance Taylor
On Wed, May 4, 2022 at 9:21 PM Will Faught wrote: > > Makes sense, although I chuckled when I realized that the creator of that > issue didn't actually have his issue resolved. I'll just note that I was the creator of that issue. Ian -- You received this message because you are subscribed to

Re: [go-nuts] Add comparisons to all types

2022-05-04 Thread Will Faught
Makes sense, although I chuckled when I realized that the creator of that issue didn't actually have his issue resolved. Creator: This behavior is undefined. Which one should it be? Go Team: Both. 😆 On Wed, May 4, 2022 at 12:46 PM Ian Lance Taylor wrote: > On Tue, May 3, 2022 at 10:59 PM 'Axel

Re: [go-nuts] Add comparisons to all types

2022-05-04 Thread Robert Engels
I was only pointing out that if you use method based operations you can do whatever comparisons you find appropriate. > On May 4, 2022, at 8:19 PM, Will Faught wrote: > >  > I don't follow how that's related to slice comparisons, aside from that fact > that slice comparison could be a method

Re: [go-nuts] Add comparisons to all types

2022-05-04 Thread Will Faught
I don't follow how that's related to slice comparisons, aside from that fact that slice comparison could be a method, but an Equals() method would be left out to be consistent with how it is today. On Wed, May 4, 2022 at 5:22 AM Robert Engels wrote: > Seems easier to move to a Go without operato

Re: [go-nuts] Add comparisons to all types

2022-05-04 Thread Will Faught
Can you explain what you mean by tokens? Do you mean something like: ``` var red, green, blue = new(struct{}), new(struct{}), new(struct{}) ``` If so, I don't see how that's useful. Why not use integers or bytes instead? On Wed, May 4, 2022 at 12:35 AM 'Dan Kortschak' via golang-nuts < golang-nu

Re: [go-nuts] Add comparisons to all types

2022-05-04 Thread Will Faught
On Wed, May 4, 2022 at 12:13 AM Axel Wagner wrote: > On Wed, May 4, 2022 at 8:42 AM Will Faught wrote: > >> Yes. I understand what you suggested and I understood how it *would* >>> work, if implemented that way. But why is that the best way to compare >>> them? Doing it that way has a bunch of s

Re: [go-nuts] Add comparisons to all types

2022-05-04 Thread Ian Lance Taylor
On Wed, May 4, 2022 at 12:53 PM 'Axel Wagner' via golang-nuts wrote: > > On Wed, May 4, 2022 at 9:46 PM Ian Lance Taylor wrote: >> >> Zero sized values are useful in Go, because they can have methods and >> they can be stored in interfaces. But if the addresses of zero-sized >> values must be dis

Re: [go-nuts] Add comparisons to all types

2022-05-04 Thread Ian Lance Taylor
On Tue, May 3, 2022 at 11:13 PM Jan Mercl <0xj...@gmail.com> wrote: > > On Wed, May 4, 2022 at 4:27 AM Ian Lance Taylor wrote: > > > In saying this I don't at all claim that Go is perfect. There are > > places where we made mistakes. > > May I please ask you to share what you personally consider

Re: [go-nuts] Add comparisons to all types

2022-05-04 Thread Ian Lance Taylor
On Tue, May 3, 2022 at 11:01 PM Will Faught wrote: > > On Tue, May 3, 2022 at 7:27 PM Ian Lance Taylor wrote: >> >> Does a program like this print true or false? >> >> func F() func() int { return func() int { return 0 } } >> func G() { fmt.Println(F() == F()) } >> > > It would print false, becau

Re: [go-nuts] Add comparisons to all types

2022-05-04 Thread 'Axel Wagner' via golang-nuts
On Wed, May 4, 2022 at 9:46 PM Ian Lance Taylor wrote: > Zero sized values are useful in Go, because they can have methods and > they can be stored in interfaces. But if the addresses of zero-sized > values must be distinct, then although zero-sized values appear to > have zero size they must in

Re: [go-nuts] Add comparisons to all types

2022-05-04 Thread Ian Lance Taylor
On Tue, May 3, 2022 at 10:59 PM 'Axel Wagner' via golang-nuts wrote: > >> As a tangent, I don't understand why this wasn't made unambiguous in the >> language spec. Why not have `new(struct{})` always allocate a new pointer? >> Who's allocating all these empty structs on the heap where this is s

[go-nuts] Re: Add comparisons to all types

2022-05-04 Thread jake...@gmail.com
On Wednesday, May 4, 2022 at 12:34:10 PM UTC-4 jake...@gmail.com wrote: > For a discussion of this issue as it relates to slices you might find this > thread worth reading through: > https://groups.google.com/g/golang-nuts/c/ajXzEM6lqJI/m/BmSu1m9PAgAJ > > That was 2016, but not much has really

[go-nuts] Re: Add comparisons to all types

2022-05-04 Thread jake...@gmail.com
For a discussion of this issue as it relates to slices you might find this thread worth reading through: https://groups.google.com/g/golang-nuts/c/ajXzEM6lqJI/m/BmSu1m9PAgAJ That was 2016, but not much has really changed since then on this issue. On Monday, May 2, 2022 at 10:43:53 PM UTC-4 wil

Re: [go-nuts] Add comparisons to all types

2022-05-04 Thread Robert Engels
Seems easier to move to a Go without operators and do everything with functions and generics. This is essentially the Java model. This is pretty much the approach that the sync, sort, etc packages took and with generics you can have type safety and less code duplication. > On May 4, 2022, at 1