Hello, I'm trying to understand how I am supposed to make use of define-syntax type constructs (or possibly, when working with older code define-macros) in a code base split over many files
I'm updating a code base from guile 1.8.8, and currently having it running successfully on guile 2 and 3. With the new auto-compilation in guile 2 and 3 I'm now trying to work out how users will invoke the tool. My concerns are based on this page of the guile manual: https://www.gnu.org/software/guile/manual/html_node/Compilation.html#Compilation specifically this: "... Guile does not yet do proper dependency tracking, so that if file a.scm uses macros from b.scm, and b.scm changes, a.scm would not be automatically recompiled." And just to confirm what the manual says, here's my test: $ cat f1.scm (use-modules (f2)) (foo 123) (define-accessor xxx 3) (xxx 9) $ cat f2.scm (define-module (f2) #:export (foo) #:export-syntax (define-accessor)) (define (foo arg) (display "foo: ") (display arg) (newline)) (define-syntax-rule (define-accessor name n) (define (name obj) (display "accessor for field: ") (display n) (display " in ") (display obj) (newline))) I'm then running `guile -L . -s f1.scm`, and indeed, as the manual suggests, changes to `foo' are visible, but, unless I force recompilation, changes to `define-accessor` are not. I also tried replacing the use of `use-modules` with raw `include`, but this is even worse, as now changes to `foo` are not seen either. My choice of `define-accessor' is not random, this is drawn from an example in the guile manual here: https://www.gnu.org/software/guile/manual/html_node/Vtable-Example.html And here lies my confusion: First, let me say I'm pretty much a scheme/guile newbie, but I thought that macros (or syntax extensions) were a huge part of the power of languages like scheme. The guile manual itself uses them to show how an object like system could be created. However, it would seem natural to place such a system into a separate file, presumably as a module. But, and here's my problem: the first time I ship this software to the user, everything's fine. But if I ship them an update that touches any of the macros, then I'm stuck. The user now needs to be aware that they have to take special steps in order to ensure the previously compiled code is deleted. And that's not great for a user experience. So, my current thinking is to wrap the invocation of the guile script in a shell script, which _always_ forces recompilation. But, if I'm doing that, I may as well just disable compilation completely. But this doesn't seem right. So, I'm sure I must be missing something here. How do others deal with this situation? - Am I missing an obvious solution for working with syntax/macros and multiple files? - Am I wrong to think that syntax/macros are such a big part of the language? Should I be limiting syntax/macro usage to small scopes, i.e. within a single file, and only true defines should be exposed outside of a file? - Maybe Guile just isn't designed for writing large, multi-file projects? - Maybe Guile projects are only ever shipped to users who are happy managing the compile cache themselves, e.g. more power users, and not really for general users? As I said, I'm fairly new to guile/scheme so my expectation here is that it's me that's missing something here. Thank you for any help you can offer, Andrew