From: "Ludovic Courtès" <ludo@gnu.org>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: guile-user@gnu.org
Subject: Re: Seeking Advice on syntax/macros in separate files
Date: Tue, 02 Mar 2021 09:23:33 +0100 [thread overview]
Message-ID: <87tupuneuy.fsf@gnu.org> (raw)
In-Reply-To: <20210301180357.GN265215@embecosm.com> (Andrew Burgess's message of "Mon, 1 Mar 2021 18:03:57 +0000")
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’.
next prev parent reply other threads:[~2021-03-02 8:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-01 18:03 Seeking Advice on syntax/macros in separate files Andrew Burgess
2021-03-02 8:23 ` Ludovic Courtès [this message]
2021-03-02 9:47 ` Andrew Burgess
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tupuneuy.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=andrew.burgess@embecosm.com \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).