I realize that FFI used to be "usable" from the VM and that it never really worked right and was thus removed and is not supported any more. I wanted to start a discussion about this feature and voice my position on it. I really like this feature and I think that having programs run almost exactly the same in the VM as they do when compiled is worth the possible abuse of this feature. It also makes it easier to write scripts in Nimrod, which is super appealing.
Additionally if I can not use the FFI during compile time or in the rpel then the workaround is to write extra executables and call them using gorge (staticExec), this starts to undermine one of the reasons I like CTFE in the first place which is that it lets me totally avoid build systems.
If we allow FFI from the rpel it would allow the use of the RPEL while coding in ways that are /very/ appealing. Imagine being able to work on code using the VM, without having to compile, but then being able to have a bunch of other parts of your program compiled and fast.
I know that this is non-trivial to implement and I wanted to start a discussion on the issues involved.
- The following procs are now available at compile-time:
math.sqrt, math.ln, math.log10, math.log2, math.exp, math.round, math.arccos, math.arcsin, math.arctan, math.arctan2, math.cos, math.cosh, math.hypot, math.sinh, math.sin, math.tan, math.tanh, math.pow, math.trunc, math.floor, math.ceil, math.fmod, os.getEnv, os.existsEnv, os.dirExists, os.fileExists, system.writeFile
Lots of other things from os can be very useful for CTE, but I hope eventually enough is possible at compile-time without having to support the full FFI. And if you consider it as a replacement for build systems (a view which I agree with btw), we only need to support what a Posix shell supports. Running SDL at compile-time is not done with more traditional build systems either.
In my opinion the REPL is a completely different thing and should not necessarily go through the compile-time VM, but through a real codegen (C based or LLVM based or whatever).
yeah if all those things can be supported than I am behind it 100%. Even for like graphics testing stuff I don't think one would need graphics code to actually happen at compile time.
It would be so amazing to have a RPEL in a systems language that works like the python or javascript ones.