scottswezey

scottswezey

Does Elixir accept PRs that wrap Erlang functionality?

I spent a while implementing Erlang’s :lists.prefix in Elixir today, only I wasn’t aware it existed in Erlang. So now I’m curious if the core team generally accepts PRs that wrap Erlang functionality. I wouldn’t mind contributing some of this “missing” functionality, if the PRs would be considered. Does anyone know? Should I ask the elixir-lang-core mailing list instead?

My arguments for wrapping Erlang functions in Elixir:

  • Similar functions, like Elixir’s List.flatten/2 and List.foldl/3, already exist and delegate to Erlang.
  • It would mostly require rewriting the specs, docs, and tests. That sounds simple enough to me. (But I could be wrong.)
  • Documentation in Elixir’s modules is more visible than Erlang’s. I think that is inherently “better,” even though Erlang can be called directly.

The potential downside is maintaining the code, should it ever change in Erlang.

Most Liked

josevalim

josevalim

Creator of Elixir

For modules that already exist, we would likely accept such PRs to complement them. For example, the List module started as a complement to Enum for list specific functions and to provide a zero-indexed API. However, if a PR is to add a wrapper for whole new modules, such as :binary or :ets, then the answer is likely no exactly because you can use them directly.

PS: note in this particular case there is List.starts_with?/2.

hauleth

hauleth

Sometimes yes, sometimes no, it depends. In general Elixir try to avoid “plain delegation” to the Erlang modules and unless there is some wrapping/argument reordering/backward compatibility requirements then it is better to just use OTP modules directly (Ockham’s law in practice).

Some of them may be compatibility reasons.

Simple, but brings unnecessary maintenance burden on core team.

I disagree. It is a little bit harder to start, but Erlang documentation is superb resource of knowledge, and with little tooling it is no harder to browse than Elixir documentation (I am talking only about Erlang/OTP docs, not EDoc output which for some reason is completely different).

scottswezey

scottswezey

Thank you both for letting me know about the PRs policy. It sounds like what I had in mind would be better off as a separate package, if it needs to exist at all.

I can’t believe I missed List.starts_with?/2. :sweat_smile:

Where Next?

Popular in Discussions Top

PragTob
Hey everyone, this has been on my mind for some time and I’d love your input on it! TLDR: I feel like maps are superioer for storing and...
New
Crowdhailer
I’ve been hearing much about the new formatter and it’s something I have been keen to try. I find examples buy far the most illuminating...
248 19760 150
New
MarioFlach
Hello, I want to share a project I’ve been working on for a while: https://github.com/almightycouch/gitgud Background Some time ago I ...
New
PragTob
Hey everyone, this has been brewing in my head some time and it came up again while reading Adopting Elixir. GenServers, supervisors et...
New
opsb
We’re considering our architecture from a viewpoint of scaling our traffic heavily over the next 6 months. Our current deployment is runn...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
arcanemachine
https://nitter.net/josevalim/status/1744395345872683471 https://twitter.com/josevalim/status/1744395345872683471
New

Other popular topics Top

Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40082 209
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42576 114
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement