[go-nuts] generics: Zero value for any type parameter

2021-12-16 Thread Johan Bolmsjö
Hello, I've been playing with the new generics support in 1.18beta 1 today. I've come across a situation a couple of times where it would be convenient to be able to conjure the zero value for a variable corresponding to a type parameter. I've searched a bit for this to no avail.

[go-nuts] Re: generics: Zero value for any type parameter

2021-12-16 Thread Johan Bolmsjö
torsdag 16 december 2021 kl. 23:40:09 UTC+1 skrev Johan Bolmsjö: > > My workaround has been to create a dummy variable, zeroValue in the > following example. I'm wondering if this is how to solve this problem or if > there is a better way. > > I realized I should have

[go-nuts] Re: Misleading documentation for time.Timer?

2023-07-07 Thread Johan Bolmsjö
false if the timer had expired or been stopped. > > For a Timer created with AfterFunc(d, f), Reset either reschedules when f > will run, in which case Reset returns true, or schedules f to run again, in > which case it returns false. > > Peter > > On Wednesday, July 5, 2023 at 5:3

[go-nuts] Misleading documentation for time.Timer?

2023-07-05 Thread Johan Bolmsjö
Hello, By accident I came across the statement "Timer type represents a single event" when seeking inspiration for a timer implementation. I wonder if this is true with the Timer.Reset method in mind, illustrated by https://play.golang.com/p/Kdg-xwmquQO. This is probably the least important