3 ms·
My first reaction is that this is a terrible idea. Very often you create a goroutine to send messages down channels. Those messages are objects. Those object
by btilly 15y ago
My first reaction is that this is a terrible idea.
Very often you create a goroutine to send messages down channels. Those messages are objects. Those objects may go to multiple other goroutines.
Kill the originating goroutine and you've just messed up all of the other goroutines that thought that they had objects.
- stcredzero 15y agoThe runtime, or the supporting library would have to take this into account. The messages would have to be in shared memory and would in any case have to be managed. I can see how this might be used for certain specific things. Because of this specificity, a library would be more appropriate than adding it to the language, though.
- jerf 15y agoBasically, mutability (including being deleted when other processes didn't expect) and message-passing turn out to go poorly together. It isn't impossible to jam them together with enough work, but you end up with a wildly more complicated system in the end... if you end up with a coherent "system" at all.
- masklinn 15y agoErm... wouldn't the GC take care of that and keep the objects alive as long as they're in the channels, or something?
- btilly 15y agoHe's talking about an extension that lets goroutines be preemptively killed, and their memory freed. The mechanism he discussed would make an end run around regular GC. My point is that it wouldn't play well with it.