Re: [go-nuts] Nil could be the zero value for type variables

2022-05-30 Thread Will Faught
Right, I discussed that: Currently, if I understand correctly, the only way to do this is to declare > a variable, and return that: > var zeroValue V > return zeroValue On Mon, May 30, 2022 at 7:33 PM Bruno Albuquerque wrote: > This should work on your example: > > var zeroValue V > > On Mon,

Re: [go-nuts] Nil could be the zero value for type variables

2022-05-30 Thread Bruno Albuquerque
This should work on your example: var zeroValue V On Mon, May 30, 2022, 6:39 PM Will Faught wrote: > Hello, fellow Gophers! > > Currently, if I understand correctly, there's no expression for the zero > value for a type variable: > > type Map[K comparable, V any] struct { > ks []K > vs

[go-nuts] Nil could be the zero value for type variables

2022-05-30 Thread Will Faught
Hello, fellow Gophers! Currently, if I understand correctly, there's no expression for the zero value for a type variable: type Map[K comparable, V any] struct { ks []K vs []V } func (m Map[K, V]) Get(k K) V { for i, k2 := range m.ks { if k2 == k { return m.vs[i]

Re: [go-nuts] How to prevent default sorting of map

2022-05-30 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2022-05-30 at 08:23 -0700, Vejju Deepesh wrote: > I want know the method of preventing sorting by default and maintain > the map in the order of insertion If you want ordered return of elements and O(1) look-up, use a slice and an index map. Insertion becomes and appends and a map

[go-nuts] Re: “Normal” vs. “error” (control flow) is a fundamental semantic distinction

2022-05-30 Thread Harri L
Thank you! Indeed, the selected names follow the try/catch idiom, and with the err2 , you can write code that includes non-local control flows. I hope that err2 is not confused with exception handling. The Go2 try-proposal

Re: [go-nuts] uber handler to collect stacktrace when program crashing

2022-05-30 Thread Harri L
If you write a wrapper, please look at the err2-package . It's an error-handling package, but we needed to build a panic-safe system with automatic stack tracing. Traces are context optimized as well. Here's a playground demo

Re: [go-nuts] How to prevent default sorting of map

2022-05-30 Thread Ian Lance Taylor
On Mon, May 30, 2022 at 10:28 AM Vejju Deepesh wrote: > > I want know the method of preventing sorting by default and maintain the map > in the order of insertion The builtin map type does not support that. Sorry. Ian -- You received this message because you are subscribed to the Google

[go-nuts] How to prevent default sorting of map

2022-05-30 Thread Vejju Deepesh
I want know the method of preventing sorting by default and maintain the map in the order of insertion -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [go-nuts] uber handler to collect stacktrace when program crashing

2022-05-30 Thread Aggarwal Sre
Yes, I was asking about a generic handler. I am thinking of writing a wrapper function which takes a function and spuns up a goroutine with the above mentioned defer function by default. On Sat, May 28, 2022 at 1:27 AM 'Sean Liao' via golang-nuts < golang-nuts@googlegroups.com> wrote: > I

[go-nuts] A cloud-native Go microservices framework with cli tool for productivity.

2022-05-30 Thread Kevin Wan
https://github.com/zeromicro/go-zero go-zero (listed in CNCF Landscape: https://landscape.cncf.io/?selected=go-zero) is a web and RPC framework with lots of builtin engineering practices. It’s born to ensure the stability of the busy services with resilience design and has been serving sites

[go-nuts] iup-go - Cross-platform UI library with native controls

2022-05-30 Thread Milan Nikolic
https://github.com/gen2brain/iup-go These are Go bindings for IUP, an amazing C library designed to help you build NATIVE user interfaces in a cross-platform way. It was developed at PUC-Rio, the same university as Lua, it started as a research project in the mid-90s, MIT licensed. The project

[go-nuts] Fwd: Possible minor specification issues

2022-05-30 Thread Jan Mercl
Gentle ping after no feedback. FTR: The proposed change was tested by an ad-hoc PEG interpreter based on the updated EBNF: https://gitlab.com/cznic/gc/-/blob/6cc7f3006a019a52c49db3d13276c0a5c6d24a00/v2/internal/ebnf/all_test.go#L275. -- Forwarded message - From: Jan Mercl