This PR creates two new files that define the structs of Channel and Locker
Take Channel as an example, we define a primitive Channel, and an interface ChanOp. The interface ChanOp has concrete implementations like ChanSend and ChanRecv. We also define some special channels like ChanTimer, which will be used for some APIs in time library.
Note: one implementation of ChanOp is ChOp. It doesn't have concrete meaning, and it is used because otherwise, we need to write concrete methods for every one of ChanSend, ChanRecv, ChanClose... This is because Go doesn't support generics
Please remove the interface design. completely unnecessary. please stop trying interface or generic any more. I think this is completely a waste of time.
This PR creates two new files that define the structs of Channel and Locker Take Channel as an example, we define a primitive Channel, and an interface ChanOp. The interface ChanOp has concrete implementations like ChanSend and ChanRecv. We also define some special channels like ChanTimer, which will be used for some APIs in
time
library.Note: one implementation of ChanOp is ChOp. It doesn't have concrete meaning, and it is used because otherwise, we need to write concrete methods for every one of ChanSend, ChanRecv, ChanClose... This is because Go doesn't support generics