[erlang-questions] Elixir community, please be more responsible; Erlang community, please demand it.

Fred Hebert mononcqc@REDACTED
Sun Mar 24 13:54:11 CET 2019


On 03/24, Joe Armstrong wrote:
>I for one welcome all the things the Elixir folks are doing - but I
>have noticed the following:
>
>- Elixir folks are re-using Erlang libraries
>- Erlang folks are not (it seems to me) reusing Elixir libraries
>
>The "how to call Erlang from Elixir" documentation is great - the
>opposite "how to call Elixir from Elixir" is not (or have I missed something)
>
>Things like nerves, scenic, Phoenix etc. look great to me - but seem to be used
>almost exclusively by Elixir folks.
>
>Has anybody made, for example, a pure Erlang interface to scenic?
>

Well, there are some limitations there.

- You can use mix to build your Erlang project and then use Elixir in 
  there
- You can use rebar3 with the rebar_mix plugin (along with an Elixir 
  install) to build Elixir dependencies (see 
  https://github.com/tsloughter/rebar_mix)

But in all cases, you will not necessarily be able to use Elixir code 
when it heavily relies on macros at the call-site rather than 
internally. So for example, a lot of usage of _plugs_ in Phoenix rely on 
macros running within the controller compilation step to read the 
declaration and inline them "somewhere??" with no obvious way to do it 
without the macros.

That specific stuff that relies on macros in _your Elixir code_ cannot 
be ported to work with _your Erlang code_, because, well, we don't have 
the same macro mechanisms available. Similarly, Erlang parse transforms 
may not remain fully applicable to Elixir modules in the future.

This means that Ecto, which is a huge part of a lot of web framework 
usage, also won't be usable for Erlang users, since it is very 
macro-dependent.

But if you look at other libraries (or frameworks) such as Raxx 
(https://github.com/CrowdHailer/raxx), then this is a framework that is 
fully written in Elixir, yet usable from Erlang (there's a demo at 
https://github.com/CrowdHailer/greetings-ace-raxx-erlang-example).  
Similarly, a library such as https://github.com/ericmj/decimal for 
arbitrary precision arithmetic should be fine to use.

This stuff has been available to rebar3 users since around late 2018, so 
I assume it has seen slow adoption due to its being rather new, but we 
(rebar3 maintainers) are confident that this bigger interplay is worth 
it and should be seeing adoption over time.

Finally, the stuff we're setting up with the Erlang Ecosystem Foundation 
is also aimed at making language interplay easier for all languages of 
the ecosystem.



More information about the erlang-questions mailing list