-
-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
require
fails when requiring a macro-utils file from other macro files (Fennel Issue #406)
#286
Comments
So this is |
Yeah, if I don't set that I can't access |
Yes, you can see rktjmp/hotpot.nvim#48 for more specific information. Its a combination of another compiler option together with |
bakpakin/Fennel#406 is fixed now 🎉 |
Is there a planned date for Conjure to use Fennel v1.1.0? As you can see this issue is still happening on the latest version of Conjure: But the bug was fixed on the release of Fennel v1.1.0 (here are the release notes).
|
Oh nice! I'll get that updated soon! Thank you for the heads up! |
This is merged and released now, will close assuming it's all good now. If not, something else might be wrong! |
Hmm, okay, I'll have to try and reproduce it. You're sure you had the latest commit from this morning?
I've run into a few issues where people thought they'd updated but their plugin manager hadn't done it for some reason. |
Also trying to understand the issue: If you try to require macros from another macro file it fails to load the helpers which breaks the parent file? |
I can't reproduce this, I used |
The other thing it could be is that your macro helpers file isn't on the path like the other macro modules are for some reason. |
As you can see in the screenshot, yes:
Not exactly, its if I try to require helper functions from a macro file. I have a file called Here is an example of the code: https://github.com/datwaft/fennel-issue_macro_require |
Here is the important snippet: (local {: fn?} (require :macro-utils))
(lambda if-fn-hello-else-bye [x]
(if
(fn? x) `(print "Hello")
`(print "Bye")))
{: if-fn-hello-else-bye} |
Got it, I understand now, will try to repro and work it out. |
Olical/aniseed#128 I think this is just this issue too. Haven't fixed it yet, sorry 😢 I keep working on other things and have been really busy recently. Will try to get this fixed very soon. If anyone wants to look into it, I think we just need to set the fennel path to the same as the lua path or something in the Aniseed compiler module. |
I just spent another 3 hours trying to get to the bottom of this and still can't work it out, I'm sorry. I just don't know how to get the fennel compiler to do what I want. I can however get this working just fine if I use I really need some help with this, if anyone can spot what args I can set or change to get the fennel compiler to treat requires inside macro files as further macro requires, please let me know. Relevant lines are here https://github.com/Olical/aniseed/blob/a7445c340fb7a0529f3c413eb99d3f8d29f50ba2/fnl/aniseed/compile.fnl#L26-L42 Maybe it's because I use This test bed works for me, for context: ;; main.fnl
(import-macros {: if-fn-hello-else-bye} :macros.user)
(if-fn-hello-else-bye :hey)
;; macros/user.fnl
(import-macros {: is-fn} :macros.utils)
(lambda if-fn-hello-else-bye [x]
(if
(is-fn x) `(print "Hello")
`(print "Bye")))
{: if-fn-hello-else-bye}
;; macros/utils.fnl
{:is-fn (fn [x]
(= `fn (. x 1)))} It's just the ability to use a regular require inside a macro file and for the compiler to know to load that as a macro as well that doesn't work. I've updated the Fennel compiler, maybe there's an option I need to set to get that working? Possibly to do with the options I provide to the compiler? (fnl.compileString
(a.merge! {:allowedGlobals false
:compilerEnv _G} opts)) |
Thanks for your effort! Maybe @rktjmp can help as Hotpot doesn't have any problem with my use case after bakpakin/Fennel#406 was merged. Sadly I don't have much experience tinkering with Fennel's internals so I don't have proper idea about how to fix this. Maybe it's an upstream issue if Fun fact: when using stdio with Fennel it works without any problem: As I don't need Aniseed maybe a workaround could be to use the stdio and somehow add to its path Neovim's API.
Btw, that test bed would always output |
It seems that because Conjure disables the compiler sandbox it is also affected by bakpakin/Fennel#406.
Inside the issue is how to reproduce the issue.
Is there a way to activate the compiler sandbox so this issue doesn't happen?
I opened this issue mainly for tracking, but a workaround would be wonderful.
The text was updated successfully, but these errors were encountered: