Hacker News new | ask | show | jobs
by travisby 1613 days ago
It might also be worth comparing to the stdlib's `container/ring` implementation of a non-generic ring buffer, to see how your code might differ between `RingBuffer[string]` and how the `interface{}` version of container/ring works!

https://pkg.go.dev/container/ring#example-Ring.Do

The casting back and forth from T and `interface{}` is expensive, boilerplatey/extracode, and panic-prone.