And what if $programmer forgets to check what's in err? What would pid contain in that case?
I mention this because I guess you quoted a kind of syntax that matches the one from Go.
So then I'm guessing that Go would simply ignore the error in this case.
However, having a proper exception mechanism, if you don't catch the problem, then it bubbles up, and the program doesn't continue with wrong data (which is a good thing => fail fast!).
This is the biggest downside of GoLang IMNSHO.
match fork() -> | Error(errno) -> ... | Pid(pid) -> ...
Or a general "Choice" sum, perhaps using phantom types so int<err> isn't compatible with int<pid>. But then all of a sudden, instead of a single word being returned, a tag and possibly variably-sized result has to be returned, and that's quite a hassle which doesn't fit well with C.
data ForkResult = Failure | Parent Int | Childpid,_ = fork()
On second thought, it'd probably avoid some nasty production failures if that behaviour was true for everything which can return an error.
Erlang gets away with it because dynamically typed + pattern matching + uses MRV for tagged returns, the second property makes it work.
pid,err = fork()