Thanks for reading!

> One question: did you consider using data []*T in the buffer?  If so,
> what made you discount it?  It seems a natural way to indicate "empty"
> slots in the slice.

I didn't consider using a []*T at the outset because I assumed that the
Buffer type would still need to be exposed to the user as part of the
old "type safe" API. Had that been the case, then creating a pubsub for
pointers to a struct (e.g. PubSub[*S]) would mean the user would have to
manipulate a buffer of pointers to pointers to structs (e.g.
Buffer[**S]), which isn't great. Now that I know the Buffer type doesn't
need to be exported, in the future (when generics are ready) I will
likely change the internal layout of the buffer and cell to incorporate
the empty marker, like in your example with the slot type.

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/aa945df2-4fe8-4056-90c2-ab6e08b2d3a7n%40googlegroups.com.

Reply via email to