wende / elchemy

Write Elixir code using statically-typed Elm-like syntax (compatible with Elm tooling)
https://wende.github.io/elchemy/
MIT License
1.15k stars 28 forks source link

Update Elchemy init script to work with Erlang 21 and higher #345

Closed ishitatsuyuki closed 6 years ago

ishitatsuyuki commented 6 years ago

I'm a beginner on Elixir. After modifying the code according to the tutorial:

$ mix test    
** (ArgumentError) argument error
    :erlang.apply({ElchemyInit, []}, :init, [])
    mix.exs:11: KaiseisaiBackend.MixProject.project/0
    (mix) lib/mix/project.ex:676: Mix.Project.get_project_config/1
    (mix) lib/mix/project.ex:111: Mix.Project.push/3
    (stdlib) erl_eval.erl:677: :erl_eval.do_apply/6

In iex:

iex(1)> Code.eval_file(".elchemy.exs")
{ElchemyInit, []}

It's returning a tuple, which doesn't seem to match what we expect.

Erlang/OTP 21 [erts-10.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Elixir 1.6.6 (compiled with OTP 21)
wende commented 6 years ago

@ishitatsuyuki It is supposed to be returning a tuple. {Module, something}.function always was an appropriate function call to Module.function({Module, something} I hope they didn't remove that from Elixir 1.6.6 (or Erlang 21). I'll investigate what's the cause

wende commented 6 years ago

It looks like Erlang 21 removes tuple calls. That means we're gonna need a redesign in how Elchemy is initiated

wende commented 6 years ago

@ishitatsuyuki A temporary fix for that would be to use

@compile :tuple_calls

in the Mix module

OvermindDL1 commented 6 years ago

Yeah tuple calls were deprecated in OTP 20, disabled in OTP 21 requiring a switch to re-activate, and is expected to be entirely removed sometime later, it has indeed saddened me...