How do I use an egg in a compiled environment?
chicken-scheme, compilation, libraries, scheme
Solution
According to the helpful information provided by Peter Bex on the mailing list, most eggs will work out of the box, you simply need to `use` them.
Certain eggs though, provide extensions to the basic reader, and the compiler needs to be told about them. You can do this with the `-X` flag. As the documentation says, `numbers` is one of those packages.
Compiling your snippet with:
csc -X numbers-syntax main.scm
worked perfectly.
I hope this helps! :)
Problem
This is a follow up to my previous question. It seems, unfortunately, that Chicken Scheme, by default, doesn't support complex numbers, but rather offers a `numbers` egg that can be installed. I have installed this egg, via `chicken-install numbers`, and I can load it in an interpreted environment. I can do this by calling `use`; either manually in the REPL, or by running my `.scm` file as a script through `csi`. For example, this script works perfectly: ``` (use numbers) (begin (display 3+3i) (newline) ) ``` when run with: ``` csi -s main.scm ``` But when I compile this exact same snippet with `csc` (even without any addtional flags), I get the same runtime error that I would if I didn't load it (e.g. an unbound variable.) It seems as if in a compiled environment `use` doesn't cut the mustard. Two other things to note, is that, per the documentation, I tried other importing functions such as `require-extension`, `require-library`, etc., but none make an difference. The other is that if I change the name of the module to something other than `numbers`, say `numberss`, it fails to compile, complaining that it can't load the extension, so obviously it is at least detecting that the `numbers` library is installed. Could anyone please explain, preferably through a short working example how to use an egg in a compiled environment? Thanks in advance! :)