Re: [go-nuts] Why is there no pure StableSort in golang.org/x/exp/slices?

2023-04-22 Thread 'Axel Wagner' via golang-nuts
It has not been added because it is pointless. Stable sorting is generally slower than regular sorting, as it puts extra constraints on the output and keeping to those makes things slower. And for a total order, *every* sorting algorithm produces a stable sort, as stability only matters if you have

[go-nuts] Why is there no pure StableSort in golang.org/x/exp/slices?

2023-04-22 Thread Uli Kunitz
I have a use case where I have to sort int32 slices repeatedly that are already partially sorted. (Imagine a tree of smaller non-overlapping segments of the same slice, where sorting starts at the bottom and moves to the top and the results of the individual sorts are required for the algorith

Re: [go-nuts] Short Variable Declarations Are Oversold

2023-04-22 Thread Bakul Shah
If you are not using an IDE, you can always use, for example, "go doc os.Open" to see what os.Open returns. For user packages, you can use for example "go doc github.com/benhoyt/goawk/parser.ParseProgram" from your directory that contains "go.mod" for your program. > On Apr 22, 2023, at 3:31 P

Re: [go-nuts] Short Variable Declarations Are Oversold

2023-04-22 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2023-04-22 at 15:31 -0700, jlfo...@berkeley.edu wrote: > What type should I use to declare “file” in the parameter list for > myfunc()? As a new Go programmer I have to admit that I haven’t > memorized all the types used in the Go standard library. So, I have > to break off working on myfun

[go-nuts] Re: Short Variable Declarations Are Oversold

2023-04-22 Thread peter so
I disagree. I don't have your problem. Most (just about all) Go code I read uses short variable declarations. There are several popular assistive technologies that you should try. For example, Visual Studio Code https://code.visualstudio.com/ GoLand https://www.jetbrains.com/go/ peter

[go-nuts] Short Variable Declarations Are Oversold

2023-04-22 Thread jlfo...@berkeley.edu
As a beginning Go programmer, I was initially attracted to the short variable declaration syntax. It’s great for declaring variables of a simple type. What could be wrong with letting the Go compiler infer a variable type by looking at what’s being assigned to the variable, such as: func ma

Re: [go-nuts] Is there a golang download for latest patch release like 1.20.x?

2023-04-22 Thread silverwind
I've raised proposal https://github.com/golang/go/issues/59776 for golang to implement stable and unambiguous versioning. On Wednesday, April 19, 2023 at 11:11:58 PM UTC+2 silverwind wrote: > > I’m not aware of a stable URL that always points to the latest patch > release like you described (ma