> If you only have the module name for some reason, then it is far to
> assume it will be Protocol + Impl name.
Do you mean "it is fair" ?

I want to avoid the cost of protocol dispatching by calling the
functions directly,
Thank you

 On Thu, 14 Jan 2021 09:48:29 +0100
José Valim <jose.va...@dashbit.co> wrote:

> 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
> <eksperimen...@autistici.org> 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 elixir-lang-core+unsubscr...@googlegroups.com.
> > 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 elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/600051e0.1c69fb81.65bb.3ed9SMTPIN_ADDED_MISSING%40gmr-mx.google.com.

Reply via email to