←back to thread

175 points nateb2022 | 1 comments | | HN request time: 0.205s | source
Show context
__MatrixMan__ ◴[] No.41522335[source]
I like that this is a thing, I'm trying to decide how excited I should be about it...

How equivalent are BEAM processes and goroutines?

replies(2): >>41522815 #>>41523150 #
kbolino ◴[] No.41522815[source]
Most significantly: goroutines are not addressable. This means that, from application code, you cannot send messages directly to a goroutine [1], you cannot link two goroutines, you cannot terminate a goroutine from another goroutine, you cannot directly watch a goroutine's exit [2], and there's nothing akin to the process dictionary (there are no "goroutine-local variables").

[1]: you usually use channels instead

[2]: you usually use sync.WaitGroup (or similar, e.g. errgroup.Group) instead

replies(2): >>41522875 #>>41540231 #
Zambyte ◴[] No.41522875[source]
Notably channels differ from actor mailboxes in that they have a capacity, and can block the sender. Mailboxes cannot block the sender, and they do not have a capacity in theory.
replies(2): >>41523022 #>>41523379 #
1. brynb ◴[] No.41523379[source]
with that said it’s quite easy to write an equivalent- https://github.com/redwood/redwood/blob/develop/utils/mailbo...