Deprecate global in favour of via

60 views
Skip to first unread message

Michał Muskała

unread,
Feb 20, 2017, 7:51:04 PM2/20/17
to elixir-l...@googlegroups.com
Currently, Elixir behaviours accept 3 ways of naming a process - a simple atom, a {:global, name} tuple, and a {:via, registry, name} one. While it's fine, the global naming always bothered me - being this special snowflake wrapped in it's own tuple. 

Exactly the same behaviour of passing {:global, name} is achieved by passing {:via, :global, name}. I propose we  deprecate the global tuple in favour of the via tuple. 

This allows reducing the amount of ideas there are to learn when first meeting processes by one thing, and we all know there are already many. Additionally this would leave a consistent scheme for calling gen* processes: an atom name, a two-tuple for locally registered process on another node, and a via tuple for registries.

Michał.

José Valim

unread,
Feb 21, 2017, 4:48:59 AM2/21/17
to elixir-l...@googlegroups.com
While there are reasons for removing :global, there are also reasons for keeping it around:

1. It is kept in sync with Erlang options
2. It shows the global aspect is a mode of operation supported out of the box
3. Erlang OTP 20/21 will ship with a much improved global mode that may promote its use more 

I have considered supporting {:registry, Name, value} once we added Registry, to accompany bullet 2, but I haven't come up with a conclusion.

While there aren't strong reasons to keep it, there aren't also strong reasons to remove it, so I don't want to push people through a deprecation cycle unless we are certain which is the best way to go.



José Valim
Skype: jv.ptec
Founder and Director of R&D

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/c782e8f3-1ae4-4e6b-a36f-2081ddf17e00%40Spark.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages