すごいE本をElixirでやる(30)

第 12 章 エラーとプロセス - 12.3 プロセスに名前を付ける から

12.3 プロセスに名前を付ける

defmoduleLinkmondodefstart_criticdospawn(__MODULE__,:critic,[])enddefjudge(pid,band,album)dosend(pid,{self,{band,album}})receivedo{pid,criticism}->criticismafter2000->:timeoutendenddefcriticdoreceivedo{from,{"Rage Against the Turing Machine","Unit Testify"}}->send(from,{self,"They are great!"}){from,{"System of a Downtime","Memoize"}}->send(from,{self,"They're not Johnny Crash but they're good."}){from,{"Jonney Crash","The Token Ring of Fire"}}->send(from,{self,"Simply incredible."}){from,{_band,_album}}->send(from,{self,"They are terrible!"})endcriticendend