i finally learned how to make chicken scheme modules lol
i put off learning how to make chicken scheme modules since i got into chicken scheme because the examples on the docs never worked for me. i think this was because, from the best of my memory, i was trying to interpret a scheme file that imported a module i made, but i hadn't generated the object files for the imported module. it kind of sucks that you have to do this, but i'm all for fucking around and finding out, so i didn't mind too much, and proceeded to write a makefile to automate some of this, and clean up the generated object files after compilation completed.
for example, if you have a
utils.scm file, which is a module, you need to
first generate an object file for it by doing this:
csc -c -static -J src/utils.scm -unit utils -o utils.o
then you can do the whole (import utils), and use shit from that.
i also found it weird that my main file that is importing things had to be a module too. oh well i guess.
this kind of led me to converting all of my module-like files, which were just
imported to my main files using includes (lol), to actual scheme modules. it
ended up being a little overkill makefile-wise to have separate
generate-rss modules, so i decided
to combine them all into a generate.scm file.
anyway, this post is mostly a "yay" post because chicken scheme modules always got the best of me. funnily enough though, i'm actually rewriting my website generator in fennel (again), so there wasn't much point in me converting all my scheme shit to module, except for the fun learning part of it. hmmmm i actually think i already mentioned in my last blog post that i'm starting another website generator in fennel... i'm too lazy to look so i'll just leave these words here for you to read lol. i'm mainly doing it in fennel because i like how small fennel is, and i like how clean the creation of modules feels. plus, i miss just using an interpreted language. like, i mean, i can interpret chicken scheme code, i just like using its compile feature too much, so i mostly just use that.
you can check out the
src/generate.scm file on this website's
source if you are curious
about how i generate object files for modules, and how i compile static binaries
for my website generator and local web server in chicken scheme.