> 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 believe local vs remote captures do not behave the same during hot code 
reloading. Remote calls always invoke the latest version of a module; so if 
*__MODULE__ *was being upgraded, and an old version was still completing 
some work, the remote call to its own function would invoke new code 
potentially incompatible with the running old version.


On Saturday, March 23, 2024 at 11:50:55 AM UTC-5 rud...@getluna.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 
> <https://hexdocs.pm/telemetry/1.2.1/telemetry.html#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 
> <https://hexdocs.pm/elixir/1.16.2/Kernel.SpecialForms.html#&/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/1de3edc4-6f32-48c6-817a-212c763433e1n%40googlegroups.com.

Reply via email to