You should use `Protocol.impl_for(data)`, which is optimized to build the module without constructing the module name manually (which can be expensive so we want to avoid it).
If you only have the module name for some reason, then it is far to assume it will be Protocol + Impl name. On Thu, Jan 14, 2021 at 4:38 AM eksperimental <[email protected]> wrote: > I am working on a protocol, and I need to have access to the module > that implements the protocol. For example, `Enumerable.List`. > > It is actually mentioned in the documentation, but I would like to know > whether this is an implementation detail or a non-documented standard > that I can rely on. In case it is an implementation detail, a function > like Protocol.impl(protocol_module, implementation_module) would be > desired. > > iex> Protocol.impl(Enumerable, List) > Enumerable.List > > Thank you. > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/5fffbcb7.1c69fb81.f59a4.3b1bSMTPIN_ADDED_MISSING%40gmr-mx.google.com > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4JVrnR32Jyp0PkysrhjbXoj%3DhqC%3DeKJeCH3jRaa_QTxJQ%40mail.gmail.com.
