Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go2go: overhaul the Buffer and PubSub types to use generics
Use the go2go generics experiment to enforce type checking at compile time instead of runtime. Switch the Buffer type to manipulate a slice of comparable T's instead of a slice of empty interfaces. Remove the global EmptyMarker in favor of a per-Buffer instance empty marker value. Add an any T type parameter to the PubSub type. Use an internal Buffer of cells of T, which hold a T value or a marker channel. The marker channels indicate an unsubscribing consumer or the closing of the PubSub instance. Drop the Publisher & Subscriber API, it is no longer needed now that the publish & subscribe methods for both functions & channels support the instance's type parameter.
- Loading branch information
1 parent
86eaf77
commit 73593d5
Showing
7 changed files
with
311 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.