-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
breakingImplementing this issue could cause existing code to no longer compile or have different behavior.Implementing this issue could cause existing code to no longer compile or have different behavior.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Milestone
Description
As of commit e2cbbd0 I count at least 4 separate ring buffer implementations:
std.fifo.LinearFifo- most generic, longest existing.std.RingBuffer- used only by zstd implementation but part of the public std API.lib/std/compress/flate/CircularBuffer.zig- internal to inflate implementation.lib/std/compress/lzma/decode/lzbuffer.zig- internal to lzma implementation.
The current std.RingBuffer implementation is not generic and only supports buffers of u8. It also only supports fixed-length ring buffers while std.fifo.LinearFifo supports a dynamically growable buffer. I think one of two things needs to happen here:
std.fifo.linearFifoandstd.RingBufferneed to make clear the tradeoffs between the APIs/implementations and present a meaningful choice between the two.- Either
std.fifo.linearFifoorstd.RingBuffershould have its functionality merged into the other and be deleted.
The flate and lzma internal ring buffer implementations are both specialized to the code using them which is fine. However, I suspect they could benefit by using a more generic implementation as a backing data structure.
I don't know exactly what the resolution to this issue should look like, quality API design is quite tricky. However, I think it is important to address before stabilizing the standard library.
alichraghi, L3P3, SeriousBusiness101, dkaste, bryanmcelvy and 17 more
Metadata
Metadata
Assignees
Labels
breakingImplementing this issue could cause existing code to no longer compile or have different behavior.Implementing this issue could cause existing code to no longer compile or have different behavior.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.