DevilKing's blog

冷灯看剑,剑上几分功名?炉香无需计苍生,纵一穿烟逝,万丈云埋,孤阳还照古陵

0%

Concurrency in go vs erlang

原文链接

A process’s mailbox is akin to Go’s channel, but it is not shared. It’s a private data buffer for that particular process to go through, one by one, synchronously. When a process sends something to another process’s mailbox, that thing gets stored there until that process can make use of it.

In imperative programming (in Go’s case, structured, which is imperative), you mostly program to change some states, and thus you have to care about WHEN each line of code gets run (A changes state X, then B reads X is consequentially different from B reads X, then A changes X)

In declarative programming, one expresses the logic without caring about control flow because each expression / function does not have side effects aka changing the state outside of itself.