Replies: 1 comment 2 replies
-
Here's how you fix the "problem". (defn f []
(print "f"))
(defn g []
(f)
(print "g"))
(defn main [& args]
(g)) Janet uses early binding. The feature is very useful in finding typos at compile-time. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I've amassed a fairly large number of utility functions in a spork-like library that I use in personal projects.
Now that the number of functions is starting to be large, symbol definition problems are arising due to the interdependency between functions and the order in which these functions are defined in the file.
Just to be clear, this is a simple, minimal, and reproducible example of my problem:
which results in:
compile error: unknown symbol f
I'm more than sure that a trivial problem like this has already been discussed here but, unfortunately, I can't find anything definitive about it here on github. The only thing related to my problem that I found is discussed in #1254. From what I learned from that discussion, I could solve my problem by doing this:
which actually works, because I get the expected result but, frankly, I hope there is an automatic and idiomatic way to not have to list all the several dozen functions in my library in advance.
As always, thank you very much for your hard and amazing work on Janet!!
Beta Was this translation helpful? Give feedback.
All reactions