neo-go icon indicating copy to clipboard operation
neo-go copied to clipboard

Go 1.18 generics

Open roman-khimov opened this issue 4 years ago • 2 comments

Looks like generics are still somewhat experimental in 1.18 and support for them will be improved and extended in future versions, so it's likely we'll only use them with 1.19 or later. Still, in this bug we can already collect ideas for their usage.

roman-khimov avatar Feb 28 '22 16:02 roman-khimov

  1. util/slice package is a low hanging fruit.
  2. We can get rid of reflection for GetVarSize and array marshaling in io. I have tried to do it in a single function and it was a mess because of the need to specify 2 types explicitly. However if we split this in 2 functions (one for array of pointers, another for array of raw structs) things may look better.

fyrchik avatar Mar 01 '22 13:03 fyrchik

  1. Client-side RPC iterators.
  2. WSClient subscriptions.

roman-khimov avatar Oct 25 '22 06:10 roman-khimov

Type-specific vm.Stack can be nice too.

roman-khimov avatar Nov 17 '22 19:11 roman-khimov

We can also add generic wrappers for event-related methods that can be generated by RPC binding generator (*EventsFromApplicationLog, etc), see https://github.com/nspcc-dev/neo-go/pull/3008#discussion_r1202990441.

AnnaShaleva avatar May 25 '23 16:05 AnnaShaleva

https://github.com/nspcc-dev/neo-go/issues/3100 can also be supported using generics.

AnnaShaleva avatar Aug 23 '23 12:08 AnnaShaleva