Early 2017 I experimented with writing a well behaved JSON parser NIF in Rust, using the Rustler project. I never wrote about it or showed it off at the time, but I recently looked back at it and realized it could do some pretty cool things.
This is the talk I held at PolyConf 2017 in Paris.
It’s on the subject of using Rust in combination with my crate rustler for writing Erlang/Elixir NIFs in a safe way.
Natively Implemented Functions, more commonly known as NIFs, are not a new thing in Erlang. They have been around for several years, and are commonly used for speeding up simple tasks like JSON parsing. The reason why they are not more commonly used for general computation is the massive disadvantages they carry with them. While Erlang is generally built for reliability and fault tolerance, all bets are off when writing NIFs written in a language like C. Any programmer error in the NIF code can very easily take the entire Erlang VM down with it, which includes all processes, supervision trees and data contained within.