While doing refactoring of channels (#21), I've separated all the raw ring/circular buffer logic into it's own object and put it in a module. I think this could prove useful:
- Separation of concern => more succinct, easily readable and testable code.
- Current channel implementation just adds locking around enqueue/dequeue ops and fullness checks, so there's nothing invasive which could prevent separation.
- Having a separate module for a basic data structure could provide a basis for a public-facing typed version easily (the only real work necessary is a JS version, which can't use any raw memory ops).
I can start with just having a separate object in the same module, and if this channel implementation stabilizes, it can be moved out and open the ways of using the basic data structure in other places.