tao
tao copied to clipboard
Foreign function interface
Hi,
First of all, this looks great! Congratulations on this awesome project.
I just wanted to ask if there is currently any usable FFI, or one in the plans. I'd love to use tao as an embedded language in my projects. However, I realize this may go against your goals of totality, as FFI functions can perform arbitrary computations.
Cheers, Tiago
I think the backend would likely need a substantial overhaul before it was ready for this, but it'll definitely need an FFI of some sort eventually.
It'll likely involve some equivalent of Rust's unsafe
, but where the safety requirements are more stringent (i.e: no observable side effects, in the case of a pure function hooked up to FFI).
I've not put an enormous amount of thought into it at this stage (my focus is currently on the frontend) but I'm hoping to write a cranelift
backend within the next few months, which opens ups the opportunity of implementing an FFI.
In the event you pick something like the ML
effect, all FFI functions could fallback to this. It would allow arbitrary I/O. AFAIK you can't really prove whether a FFI function will yield a pure computation, unless yeah you explcitly stated this with an unsafe
hint of sorts.
Either way, looking forward to the implementation of this feature. Good luck!
Thanks! I'm hoping I'll have some more time over the coming months to dive into the new backend and make this a reality!