In Erlang, the last expression of a function is the return value, so it might be tempting for someone to check that global:unregister_name/1 or Mod:unregister_name(Name) return and try to match the template with this.
_ = expression() does nothing special, but hints that this return value should be ignored (for example, because they are not documented and can be changed). However, in the last expression, Pid is returned explicitly. This means that you can map the pattern as follows:
case unregister_name(Something) of Pid when is_pid(Pid) -> foo(); _ -> bar() end.
To summarize: these lines do nothing, but when someone reads the source code, they show the intention of the original programmer.
Unfortunately, this particular function is not exported, and in the source module it is never used in accordance with the template, so I have no example for backup :)
source share