[go-nuts] [generics] Example

2020-06-25 Thread ancientlore
One of the first things I wrote in Go (in 2010) was a height-balanced binary tree. I was trying to use a number of Go's features to learn. Recently I converted this project to use generics. I tried not to deviate from the original design too much, so that they could be compared. (That said,

Re: [go-nuts] What is the impact of allocation costs on latency?

2020-06-25 Thread doohick
Thank you for your reply Ian. I should have mentioned that I was looking at the sources for Go 1.14.2. I see the scheme you're describing is in the as yet unreleased 1.15 sources (and the function I was concerned about is now called 'oldCacheSpan'). It's great to see the developers drive down

[go-nuts] Re: [generics] Thank you Go team

2020-06-25 Thread ancientlore
+1. I found the new draft readable and in practice it feels quite natural. My hope was always that generics would "feel like Go". On Tuesday, June 23, 2020 at 12:34:30 PM UTC-4 Haddock wrote: > Also big +1 from my side and kudos to Ian for always answering to this > storm of objections and

Re: [go-nuts] [generics] () instead of (type T)

2020-06-25 Thread Ian Lance Taylor
On Sat, Jun 20, 2020 at 10:33 AM wrote: > > The type parameters in the current proposal uses `(type xxx)` which is > visually hard to distinguish from function parameters. > > There are reasons stated in the proposal to not adopt <> (which is common in > other languages) which I'm not going to

[go-nuts] Slices and inconsistency

2020-06-25 Thread chandrak13579
Hi, I am trying to learn Go (I have been working with C++ for a while). I see inconsistency of slices and append func main() { // append example within capacity var m []int = []int{1, 2, 3} a := m[0:2] b := append(a, 4) a[0] = -1 fmt.Printf("%v, %d, %d\n", m, len(m), cap(m)) fmt.Printf("%v,

Re: [go-nuts] Slices and inconsistency

2020-06-25 Thread Ian Lance Taylor
On Thu, Jun 25, 2020 at 5:58 PM wrote: > > Hi, I am trying to learn Go (I have been working with C++ for a while). I > see inconsistency of slices and append > > > func main() { > > // append example within capacity > var m []int = []int{1, 2, 3} > a := m[0:2] > b := append(a, 4) > a[0] = -1 >

Re: [go-nuts] Re: Graphic Go Algorithms: Graphically learn data structures and algorithms better than before

2020-06-25 Thread Christian Staffa
it seems not to be available for germany users 郎 Sent from my iPhone > On 25. Jun 2020, at 21:20, Yesudeep Mangalapilly wrote: > >  > Hey, thanks for this. It looks good! > >> On Wednesday, June 24, 2020 at 7:58:49 PM UTC-7, huya...@gmail.com wrote: >> free book just 5 day left >> >>

[go-nuts] Re: Graphic Go Algorithms: Graphically learn data structures and algorithms better than before

2020-06-25 Thread Yesudeep Mangalapilly
Hey, thanks for this. It looks good! On Wednesday, June 24, 2020 at 7:58:49 PM UTC-7, huya...@gmail.com wrote: > > free book just 5 day left > > https://www.amazon.com/gp/product/B08BFXNTFF > > [image: Graphic Go Algorithms: Graphically learn data structures and > algorithms better than before

Re: [go-nuts] What is the impact of allocation costs on latency?

2020-06-25 Thread Ian Lance Taylor
On Thu, Jun 25, 2020 at 10:32 AM wrote: > > Thank you for your reply Ian. I should have mentioned that I was looking at > the sources for Go 1.14.2. I see the scheme you're describing is in the as > yet unreleased 1.15 sources (and the function I was concerned about is now > called

Re: [go-nuts] Re: Measuring resource usage of child processes

2020-06-25 Thread Ian Lance Taylor
On Wed, Jun 24, 2020 at 10:42 PM Brian Candler wrote: > > My problem is actually around exec.CommandContext. I mentioned > os.Process.Kill is because that's the interface that exec.CommandContext uses: > > > The provided context is used to kill the process (by calling > > os.Process.Kill) if

Re: [go-nuts] Re: Measuring resource usage of child processes

2020-06-25 Thread Brian Candler
That goroutine is launched at the end of Cmd.Start , rather than in exec.CommandContext. That makes sense: you don't want to start the time bomb until the process has been assigned a pid. Cmd.Run just does Cmd.Start followed by

Re: [go-nuts] Is there +v Stringer interface?

2020-06-25 Thread yves baumes
Thank you all :) Le jeu. 25 juin 2020 à 06:37, andrey mirtchovski a écrit : > >> fmt.Formatter is woefully under documented. > > > > My reference is pkg/errros - > https://github.com/pkg/errors/blob/master/errors.go#L127 > > we have wasted tens of man-hours hunting for a bug that didn't >

Re: [go-nuts] [runtime] Scheduling overhead incurred by the runtime

2020-06-25 Thread Jesper Louis Andersen
On Tue, Jun 23, 2020 at 6:33 PM Deepak Sirone wrote: > > Process A sends a message to B using the "encoding/gob" package to write > to the socket which is subsequently decoded. After sending a message, A > waits for a response from B. B does some processing on the message and > sends a reply

[go-nuts] Re: [generics] Use decorators ($, or @, or #) to specify that the type is a generic type.

2020-06-25 Thread Andrey T.
Good point. Without some additional rules to "freeze" it once seen in a declaration, that would become "apples" to "oranges" very fast. Well, I guess scratch point 3 off the list then :) On Wednesday, June 24, 2020 at 10:55:10 PM UTC-6, haskell...@yahoo.de wrote: > > On Thursday, 25 June 2020

[go-nuts] Using repository on non-standard port

2020-06-25 Thread Brian Candler
If I have a local bitbucket server which is accessible via ssh on port 7990, what's the best way to use it with go.mod? I found this issue: https://github.com/golang/go/issues/26912 which said that module paths are for module identity rather than module location, which is fair enough, but how