5 ms·
i like the pattern, but message passing where the message is actually just a pointer to a mutable struct ( as allowed in go) kind of defeat the purpose, doesn't
by bsaul 2y ago
i like the pattern, but message passing where the message is actually just a pointer to a mutable struct ( as allowed in go) kind of defeat the purpose, doesn't it ?
- superb_dev 2y agoIt kinda does yeah, you probably shouldn’t do that
- adastra22 2y agoIt’s fine if that’s the only (writable) pointer to the struct. Which is something go doesn’t enforce, but Rust does. I often dream of Go with Rust’s borrow checker. Sigh…
- dgb23 2y agoNo, it’s an idiomatic way of expressing who’s in charge of a given piece of data. There’s nothing in the type system preventing data races. But that’s orthogonal to channels. They just help you to structure the code.