3 ms·
> Rough analogy: writing to a file by name (process, Erlang) vs. writing to a file descriptor (channel, Go). That analogy doesn't really work, messages can be
by masklinn 14y ago
> Rough analogy: writing to a file by name (process, Erlang) vs. writing to a file descriptor (channel, Go).
That analogy doesn't really work, messages can be sent to an Erlang process by pid, how this pid came to be obtained isn't necessarily through naming (you can also register a process to a name, in which case it is indeed like writing to a file by name), and some of the things messages are sent to are not actual processes (e.g. ports).
- jlgreco 14y agoThe way I see it is that you write to files with an fd, but and fd can point to more than just files.
- masklinn 14y ago> some of the things messages are sent to are not actual processes (e.g. ports).
- jlgreco 14y agoAh, fair enough. I don't know erlang. Can a process have multiple distinct channels it receives on?
- masklinn 14y agoNope, each process has a single mailbox. On the other hand, processes don't have to go through their mailbox sequentially, they can prioritize messages (through pattern matching) and handle these first even if they are the last message in the mailbox (it's called a "selective receive"), so you get the same feature trivially by tagging messages instead of sending a message to a different channel.
- deleted 14y ago[deleted]