Alternative FFI designs #1132
lpil
started this conversation in
Ideas & suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The current FFI is based around the idea of functions that live in modules. This works well for Erlang, but does it fit other languages?
JS for example has modules, global functions, and global objects.
External module per package
Rather than functions being able to be imported from any module we could have all external function definitions in a package import from a dedicated external module.
Here the entrypoint for the native code from Gleam is clearly defined and predictable for us, and is free to import values from anywhere in any way they wish.
We would need to rename the Erlang module at compile time to avoid collisions between packages.
How well would this map on to other languages and platforms we might target in future? How might this work if linking to
.so
or.dll
files in future if we had native compilation? Web assembly? etcBeta Was this translation helpful? Give feedback.
All reactions