From cb4d062835d5be26faf2cd110e0dc7863d8fea19 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 6 Sep 2024 02:32:46 -0700 Subject: [PATCH 1/2] improve clarity of consolidated protocol's optimisation --- lib/elixir/lib/protocol.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/elixir/lib/protocol.ex b/lib/elixir/lib/protocol.ex index fba6327de7b..d0d1e4c2c59 100644 --- a/lib/elixir/lib/protocol.ex +++ b/lib/elixir/lib/protocol.ex @@ -222,7 +222,7 @@ defmodule Protocol do are known up-front, typically after all Elixir code in a project is compiled, Elixir provides a feature called *protocol consolidation*. Consolidation directly links protocols to their implementations in a way that invoking a function from a - consolidated protocol is equivalent to invoking two remote functions. + consolidated protocol is equivalent to invoking two remote functions - one to identify the correct implementation, and another to call the implementation. Protocol consolidation is applied by default to all Mix projects during compilation. This may be an issue during test. For instance, if you want to implement a protocol From 9432c8f6ca67fa7307b826c9210145741a2757c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 6 Sep 2024 11:36:24 +0200 Subject: [PATCH 2/2] Update lib/elixir/lib/protocol.ex --- lib/elixir/lib/protocol.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/elixir/lib/protocol.ex b/lib/elixir/lib/protocol.ex index d0d1e4c2c59..b2085ad2d6c 100644 --- a/lib/elixir/lib/protocol.ex +++ b/lib/elixir/lib/protocol.ex @@ -222,7 +222,8 @@ defmodule Protocol do are known up-front, typically after all Elixir code in a project is compiled, Elixir provides a feature called *protocol consolidation*. Consolidation directly links protocols to their implementations in a way that invoking a function from a - consolidated protocol is equivalent to invoking two remote functions - one to identify the correct implementation, and another to call the implementation. + consolidated protocol is equivalent to invoking two remote functions - one to + identify the correct implementation, and another to call the implementation. Protocol consolidation is applied by default to all Mix projects during compilation. This may be an issue during test. For instance, if you want to implement a protocol