[dead]

Another spot it's great for is in legacy lua programs that you inherit from who knows where, which in my experience is a lot of the live lua out there. It hooks into the module loader system so you can just freely mix functions and tables between the two.

> Fennel's approach of compiling to Lua while maintaining meta-programming capabilities is elegant.

Yeah, it is very nice to work with.

The only tiny "complaint" I have is that it doesn't compile to pure Lua, but instead assumes you'll be running it together with Lua's libraries.

I say this because, for me, the places where I'd like to use Fennel have a lot of overlap with the places where I'd like to use Lua without loading any of the provided libraries (e.g. embedding Lua into other software, instead of using it standalone).

Wait what do you mean? If I understand you correctly I use fennel for this all the time, I just copy the compiled lua into the place the program expects to find lua scripts.

Sandboxed lua can't assume it has access things like debug libraries or any of the file IO, among other things. Many setups pretty aggressively remove and/or patch libraries and even large parts of the default global table. Assuming a vanilla lua library environment can make a project like this unusable in many places.

Oh, sure. I didn't realize fennel used those libs in the compiled lua output if you don't call to them. I've never run into this problem and again I've written a lot of fennel that is targeting locked down scripting environments. I probably don't use all of its features though so maybe just got lucky so far.

I might be remembering wrong on where the problem was exactly, but it was either the generated code, or the code for the Fennel transpiler itself.

I just know that I tried to use it without loading Lua's libraries (i.e. without calling the `luaL_openlibs` function or equivalent) and was unable to.

> I just copy the compiled lua into the place the program expects to find lua scripts.

Yeah most existing programs just load all Lua libraries by default, so that's generally not an issue.

My post is more from the point of view of embedding a restricted Lua interpreter into a program (i.e. only Lua-the-language, not Lua-the-language-plus-its-libraries) while still supporting Fennel.

---

EDIT: Just checked, the Fennel code `(lambda [foo bar] bar)` compiles to Lua code that calls `_G.assert`.