[erlang-questions] -pidname( <atom> ) Was: Why we need a -module() attribute?

Valentin Micic valentin@REDACTED
Fri Feb 26 07:02:13 CET 2016

> Almost all process registrations should be local to the module that registers
> them.  I proposed
>      -pidname(<atom>).
> for declaring a module-locale atomic variable to hold pids.  This would be both
> safer than the global registry and more efficient.  The global registry would
> remain for those things that genuinely need to be global.

Presuming that the module name is , say,  test,  how is:

-pidname( test )

different from:

register( ?MODULE, self() )?

Also, how would you run multiple instances of the same module within the same run-time?
Your proposal may appear to solve one problem (that is, if one chose to call it a problem), but appears to introduce at least one more.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160226/1a773eb8/attachment.htm>

More information about the erlang-questions mailing list