Search code examples
erlangerlang-otp

Erlang global and local names


Why local names (registered using erlang:register/2) can only be atoms and not arbitrary term, but the global names could be anything (registered using global:register_name/2,3).

Type spec from gen.erl:

-type emgr_name()  :: {'local', atom()}
                    | {'global', term()}
                    | {'via', Module :: module(), Name :: term()}.

Why there is no way to give a local gen_server an arbitrary name?


Solution

  • Because local registration is feature of Erlang (written on C). But global registration is feature of global module from OTP. it just extension of standard behaviour.