1. 17

  2. 2

    Rust seems to have a really impressive interop ecosystem, catching up on C as far as I can tell.

    Is it because people really want to use it as an extension language? Is it because Mozilla or Rust foundation are sponsoring these projects?

    1. 3

      In the specific case of Rustler, I assume what’s happened is that Mozilla happened to contain a bunch of people who are enthusiastic about Elixir (*) and people who are enthusiastic about Rust, and probably those people talk to each other.

      (* the evidence I have for this is that a large part of Mozilla Hubs is written in Elixir)

      1. 1

        I think it’s broader than just Elixir as the above comment says since there are also efforts for languages like Ruby and Python in addition to others. What do you think?

        1. 1

          I did not say that it’s limited to elixir.

      2. 2

        Traditionally, when dropping down into a lower-level language from a higher level one, the go-to would have been more often than not C++. These dropped-down libraries tend to be relatively small, because you’re writing your more complicated logic in the higher language, so the new library ends up only handling whatever compute-heavy task you need it to. This lends itself to being easy to re-write, since the entire thing is relatively handle-able.

        At Rust’s current state, it’s safe to say it blows C++ out of the water in terms of developer ergonomics, and it’s hip, on top of all its other upsides. Being approximately a complete upgrade from C++, it doesn’t make a lot of sense to use an obsoleted language in a greenfield project. Combine that with people’s tendency to reinvent the wheel when it’s not too inconvenient, you end up with a bunch of Rust libraries.

        In the specific case of Elixir, dropping down into C/C++ libraries is considered a last-resort type activity, because unlike just about anything you can do within the BEAM, misbehavior there can cause an entire BEAM node to crash. Rust, with its safety promises, makes NIFs significantly less worrisome.

      3. 1

        If you don’t want to use Rust, Zigler is pretty amazing in its integration story.