3 ms·
C# can, it's design is copied from Java. Go and Rust can't share memory natively, they need to copy data. So you probably should not make "games with go".
by bullen 8y ago
C# can, it's design is copied from Java. Go and Rust can't share memory natively, they need to copy data.
So you probably should not make "games with go".
- whiteandnerdy 8y agoGo prefers message passing of copies using channels, but absolutely does permit shared state if you want it. I've written multithreaded code with shared state in Go myself. You just need to pass a pointer to the state across a channel, and can then control access using synchronisation primitives such as mutexes in exactly the same way you would in Java or C.
- zokier 8y agoObviously Rust can share memory between threads. Just see the docs for mutex as an example: https://doc.rust-lang.org/std/sync/struct.Mutex.html https://doc.rust-lang.org/std/sync/struct.Mutex.html
- beefsack 8y agoThis comment is terribly misinformed. You absolutely can share memory between threads in Rust and can do it without race conditions (eg Arc pointers and Mutex).
- gameswithgo 8y agoGo has a built in message passing system in the language but you can share memory between goroutines without friction, and you can lock goroutines to real os threads if you want, too. I did both in my gameswithgo stream. It was a fun time!