We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Creating Robust Native Implemented Functions in Elixir
169
clicks
Source: youtube.com
In his talk, Susumu Yamazaki, an associate professor, highlights the challenges and best practices for implementing NIFs in Elixir applications. He outlines the risks associated with NIFs, notably how a crash can terminate the entire BEAM VM, bypassing the supervision tree. Yamazaki provides three key points for creating robust NIFs: First, setting conditional branches for uncertain return values to prevent crashes. Second, adhering to Elixir's error handling conventions with tuples containing ':ok' or ':error'. Third, using assertions to define preconditions and raise exceptions, which supervisors can handle, thereby preventing disruptions from unintentional inputs or outputs. He also discusses reasons for preferring NIFs over ports for performance, yet suggests using ports if existing NIF libraries require excessive modifications to adopt his robustness strategy. In Q&A, Yamazaki acknowledges Rust's robustness but explains his focus on traditional methods using C for NIFs in the presentation.
Related posts
© HashMerge 2024