-
Notifications
You must be signed in to change notification settings - Fork 112
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
Eval behaves differently in compiled binaries #1253
Comments
You need to initialize the expander explicitly in binaries! So, import |
Thanks for quick reply! I have changed my code to be: (import :gerbil/expander)
(export main)
(def x 1)
(def file-path "xxx.ss")
(def (main . args)
(gerbil-load-expander!)
(eval `(include ,file-path)))
But I still getting an error:
|
Yes, gerbil-load-expander! needs to be called from main or childten. Regarding the unbound variable; You need to extern declare it for your actual namespace. Alternatively, you can export it in your main module and import that, but it requires your module's ssi to be visible to the binary. So, i recommend the extern approach. Or: |
Now it is working! Full code for history:
(import :gerbil/expander)
(export main)
(def x 1)
(def file-path "xxx.ss")
(def (main . args)
(gerbil-load-expander!)
(eval `(include ,file-path)))
(extern (x schemered/yyy#x))
(display x)
(display "\n")
(package: schemered) I feel like I should document it somewhere... but not sure where... what do you think? |
Agreed, it should be documented! Not sure where to put it either, maybe somewhere in the guide? |
I have started to writing some notes about eval. Not sure I am 100% correct and eval requires a separate page, but we may gather some practices here, so I thought "why not" :) |
Adding page about eval & differences to expect in interactive & compiled mode. Motivated by #1253 Maybe we could gather `eval` related practices on this page?
I have faced an issue with eval environment inside compiled binaries. Here is the example...
Gerbil:
Gerbil interpreter works fine:
Gambit works fine:
The text was updated successfully, but these errors were encountered: