Closed Grazfather closed 2 years ago
Hm, I've never used this before, I've never used the Lua escape hatch for anything as I see it as something that should only be used if there is absolutely no other way of doing something. Is there any way you can implement your control flow without a return? I've never had to use one despite all of the Fennel I've worked with.
If there's absolutely no other way I can take a deeper look but I am not surprised that something like this causes issues really, I'd just highly recommend never ever leaning on that and encoding all of your control flow in Fennel. Which may mean a recursive call with a base case to exit at some point. Or even a Lua while loop?
Yeah it can certainly be done without, but basically (for my use) it would mean everything that can only be done with a plugin installed would have to be nested within the sexp that tries to import it.
I was basically trying to
treesitter.fnl
(module stuff)
; This will return from the module if treesitter can't be imported.
(try-or-die-require {: :treesitter})
(treesitter.setup {...})
I can do something like
(module stuff)
(with-require {: :treesitter}
(treesitter.setup {...}))
I just wanted to avoid, and still thought it was worth reporting that something as simple as (lua "return")
breaks.
Feel free to close if you don't care to investigate or support (lua ...)
stuff.
FWIW (lua "return")
at the top level of a file gives bad output even without aniseed.
(require "fennel.view")
(lua "return")
gives you:
require("fennel.view")
return
return nil
which will give you an error if you try to run it
Ah! I don't know lua well. Apparently lua doesn't like more than one return statement at the top level of a module.
Maybe it just manifests in a weird way with aniseed.
Going to close this issue since I don't really plan on doing anything about this (I also don't know what I could do 😬 ) I hope that's okay!
No sweat.
I was writing a macro to
try!
to require and to just end the module early in case of failure.While debugging I noticed that adding
(lua "return")
anywhere breaks aniseed. Even something as simple as:This yields:
Yet I still get this error: