guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Seeking Advice on syntax/macros in separate files


From: Ludovic Courtès
Subject: Re: Seeking Advice on syntax/macros in separate files
Date: Tue, 02 Mar 2021 09:23:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi Andrew,

Andrew Burgess <andrew.burgess@embecosm.com> skribis:

> 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."

Yes.  Concretely, that means you can either use Makefiles or similar
(like with most other languages) or turn off auto-compilation (with
‘--no-auto-compile’ or with ‘GUILE_AUTO_COMPILE=0’).

> 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?

Common practice is to have makefiles or similar as part of your
software.  When you run “make”, it runs ‘guild compile’ to compile all
your Scheme source; upon “make install”, both .scm and .go files are
installed.

Here’s an example that does that using the GNU autotools:

  https://notabug.org/cwebber/guile-gcrypt

For a pure Guile project, Guile Hall helps get started:

  https://gitlab.com/a-sassmannshausen/guile-hall

> - 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?

Macros are very useful and a salient point of Scheme, but there are many
other things in the language.  :-)

> - Maybe Guile just isn't designed for writing large, multi-file
>   projects?

There are large projects written in Guile, such as Guix.

> - 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?

Like I wrote, non-trivial projects often install .go files alongside
.scm files such that things never go through ~/.cache/guile.

HTH!

Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]