3 ms·
Channels. Share information between routines with channels. If you're passing pointers to mutate down a channel, then that's on you. Just set yourself on fire,
by smokey_circles 5y ago
Channels. Share information between routines with channels. If you're passing pointers to mutate down a channel, then that's on you. Just set yourself on fire, much easier that way lol.
You don't need immutable structures to communicate between goroutines. Value types are fine. Just think a bit about how to use channels as signal carriers, it eventually starts to make sense
- BreakfastB0b 5y agoI think I miscommunicated what I meant, there was an implicit assumption that copying value types over channels was bad due to GC overhead. Efficient Immutable data structures let you have your cake and eat it too. You can avoid GC overhead by sharing structure but avoid problems with mutation between goroutines.