In this podcast:
there is an interesting discussion starting here about Generics and use of channels, reflection, and other advanced techniques.
A few quotes:
I think it’s exactly like code generation and reflection and all these other things; I think channels goes in this, too… It’s like, we don’t need to use them most of the time. But when we do need to use them, they are very useful to have. But it’s difficult to figure out when and why you should be using these things, and it takes a lot of time and experience, and while you’re building that time and experience, there’s a cost that you have to pay for having those things in the language… And it feels like we’re adding another big one, that’s like “Okay, now we’re just gonna have to teach a lot of people and figure out as a community how do we wind up writing Go code that still feels like the Go code that we’ve had in the past, with this new feature.” I think that’s just gonna take a lot of time and a lot of effort, and it’s gonna cause a lot of stressful things for people.
Yeah, it’s funny – I mean, I’m guilty of this… When I learned about channels, I loved it, because I saw some example cases where it was used brilliantly… And then I over-used it. And it wasn’t that it didn’t scale in my case, it was that it was hard to follow what was happening. And then I started just using a mutex… And I’ll tell you what - just saying “lock” and “unlock” is very clear; that’s really all you need. It’s kind of perfect.
This perhaps relates to a theme I’m also discovering in the Simple IoT project – simple types and data structures make a lot of sense when it comes to data storage, transmission, and synchronization. Why? Because the core of the system can remain the same and not much needs to change when you add functionality to your system. This is especially important in distributed systems. There are of course limits to this concept, but when used appropriately, it makes life much easier.