Skip to content

Conversation

sasa1977
Copy link
Contributor

The issue is described here

tl;dr of it is that a situation can happen that a mix task works with an older version of the module written in Erlang. This can occur if some previous task, (e.g. Phoenix compiler) loaded the module before the Erlang compiler recompiled the code. The agreed solution is to make the Erlang compiler purge the module if it is about to be compiled.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can call this (and above) fun instead of fn? Just not to mess with Elixir's keywords 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fun is an Erlang keyword. :bowtie:
I suggest my_fun as we usually do my_ prefixing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is Erlang code, so your reasoning is in fact why I called it fn :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ahah, right 😄 Let's go with my_fun or my_fn then :)

@whatyouhide
Copy link
Member

Other extreme nitpick: can we use capital letters in the commit message as well? :bowtie: (Purge Erlang modules on recompilation)

@sasa1977
Copy link
Contributor Author

Sure, once you're done reviewing, I'll change the history and force push.

@whatyouhide
Copy link
Member

And nitpicks apart, great job @sasa1977 💟

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test could be easier if you simply define an Elixir module before calling Compile.Erlang. Something like:

defmodule :purge_test do
  def version, do: :v1
end

This way you don't need to write to disk and compile multiple times.

@sasa1977 sasa1977 force-pushed the purge-erlang-modules-on-recompilation branch from 9864708 to 2def8da Compare March 30, 2016 16:35
@sasa1977
Copy link
Contributor Author

OK, I think I addressed it all, squashed and force pushed.

@josevalim josevalim merged commit 29fef97 into elixir-lang:master Mar 30, 2016
@josevalim
Copy link
Member

Merged and backported to v1.2 (new release coming this or next week).

josevalim added a commit that referenced this pull request Mar 31, 2016
…ilation

purge erlang modules on recompilation

Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
@sasa1977 sasa1977 deleted the purge-erlang-modules-on-recompilation branch February 24, 2020 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants