Provide a way to compile macros to Lua to ship those with luarocks

Macro modules contain ordinary functions, which just so happen to use lists manipulations in those. This should not prevent such modules from compiling to Lua, and being loaded from Lua. However, since lists and symbols are just a compile time construct and do not have a direct representation in Lua, maybe those can just be compiled into sequential tables that somehow indicate that this is should be decompiled back into Fennel list?

I've given some thought to it, and perhaps we can compile `(a ,b) into something like {"fnl/backquote", {"fnl/list", "a", {"fnl/unquote", "b"}}} which is a valid lua, and require-macros will know if it gets a lua file, these tables do represent `(a ,b).

I guess you can give it more thought though, as you know compiler internal representation of a list much better, and maybe it can be compiled to Lua in a more safe to decompile way

Assigned to
8 months ago
18 days ago
enhancement macros

~technomancy referenced this from #51 5 months ago

~technomancy REPORTED FIXED 18 days ago

This has worked for a while now, but I added a test for it: https://git.sr.ht/~technomancy/fennel/commit/6e88b217bfc493a7d5448fb884e50cf7717643e3

Register here or Log in to comment, or comment via email.