The are some subtle differences - the function needs to be exported (remote capture doesn't work with defp). Furthermore, there's a difference in case of module reloading - local capture will always dispatch into the version of the module that created it, remote capture will always dispatch to the latest version of the module. 


On 23 Mar 2024, at 16:50, 'Rudolf Manusadzhian' via elixir-lang-core <elixir-lang-core@googlegroups.com> wrote:

Hi there! Might be a naive question.

Why don't we treat all local captures as external? Like at compile time, if it's possible, we could treat &fun/0 as &__MODULE__.fun/0 and get a free performance boost, if in the end they behave same.

I was going thought the docs for :telemetry.attach/4 and the suggestion to avoid using local captures raise that thought.

If that's not possible, does it make sense to add a note in the docs Kernel.SpecialForms.&/1 # Capture about the performance implications of local capture vs external or a recommendation?

Thanks.

--
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/c7065947-b48d-43e6-a450-387f6d4f1846n%40googlegroups.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/452B5A69-91AD-47D7-8CB5-1ACBCC56715D%40muskala.eu.

Reply via email to