On one hand, adding a new scripting language to #iocaine is very straightforward now. Just impl SexDungeon, a simple trait with 3 functions: new(), decide() and run_tests(), and I'm pretty much good to go. This lets me play with whatever Rust-embeddable language I can put my hands on, with ease.

On the other hand, of the handful of embeddable schemes and lisps that aren't completely dead, none of them run at acceptable speed.

"What is acceptable?", you may ask.

Well, anything faster than ~40k req/sec in release mode will do. Why ~40k req/sec? Because that's my reverse proxy's bottleneck.

I also expect a very naive implementation of return false to run at at least at 1k req/sec in release mode.

What's a naive implementation? Creating the runtime environment on every request, and compiling the trivial program on every request.

In other #iocaine news, I'm doing some final polishing on #Lua scripting support, to make it as convenient as #Roto.

Right now, there's a differenc between how Lua and Roto scripts are loaded: with Roto, one needs to give a path to a directory, and pkg.roto will be loaded from there, and any imports will be relative to that directory.

With Lua, one gives iocaine a file path, and - currently - needs to set up the package.path search path manually.

So here's what I'll do: I'll make iocaine require a directory for Lua too, and it will add it to package.path, and will require("main"). The required module will also have to return a table with at least a decide key, and an optional run_tests key. This will simplify finding the functions to run, and will greatly reduce the number of special cases.

After that, I'll try to figure something about how to support #Fennel better, natively. The current idea is to have it exposed as another scripting language, built as a wrapper around the Lua engine, with some additional setup at init time:

  • Load the fennel compiler from somewhere
  • Update fennel.path
  • Run fennel.install()

I could embed the fennel compiler, it is small enough, and releases aren't frequent. So that's an option. I don't want to pull it into the sources, though, so I'd need a way to do grab it during build or something. That's a bit problematic, however.

So the next best thing I could come up with is:

[server.request-handler]
path = "/path/to/some/fennel/code"
language = fennel
options = {
compiler = "/path/to/fennel.lua"
}

1+ more replies (not shown)