It's unnecessary to manually load .go files. You can pre-compile .scm to .go and install to the compiled-load-path. And put .scm to load-path, if your path is correct, and if the .scm is no newer than .go, Guile will automatically load .go directly without auto-compilation.
BTW, I saw some Guile project didn't install .go to correct path. Even if Makefile compiled .go and installed, the program will trap to auto-compilation for the first time. However, it's the matter of tweak the install path, rather than manually load .go. Best regards. On Sat, Dec 14, 2024, 22:01 Maxime Devos <maximede...@telenet.be> wrote: > Compiling the .scm to .go ahead of time (with guild) and loading the .go > directly makes a lot of sense: > > > > - It avoids issues with locating the .go (no need to set .go path when > invoking guile, although if it does use additional dependencies, depending > on where they are located the script may need to set the .go (and .scm) > path). > - It needs to look at less files (no need to compare .scm & .go > modification times) (*) > - Easier to set compilation options (e.g. optimisation level) > - It avoids auto-compilation (no "compiling this thing / that thing” > messages, no compilation cache filled with old junk, and in case of some > forms of containerisation, avoids permission issues & transmission vector). > > > > (*) won’t make a big difference since it most likely uses other modules, > but it’s something. > > > > >I tried the following commands with no luck: > > >guile3.0 example.scm.go > > >guile3.0 --language=bytecode example.scm.go > > > > To my understanding of the language tower, the second is supposed to work. > What does “no luck” mean here? (I don’t have a guile setup at the moment.) > > > > (You need to recompile in case of some version changes, but that’s hardly > Guile-specific.) > > > > (There is an internal caching mechanism for autocompilation, but AOT (to > bytecode) is a fine thing to do, and Guile supports that too. I recommend > it for things like libraries and installed software (for random scripts > autocompilation is likely good enough unless the extra messages or shared > (per-user) cache directory are problematic.).) > > > > Best regards, > Maxime Devos >