unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Olivier Dion <olivier.dion@polymtl.ca>
To: ksoft@sent.com, guile-user@gnu.org
Subject: Re: Quiet compilation for scripting
Date: Fri, 15 Mar 2024 13:31:43 -0400	[thread overview]
Message-ID: <87bk7f9zb4.fsf@laura> (raw)
In-Reply-To: <4f8f12d4-92f9-4183-b094-3b04f52c9f95@app.fastmail.com>

On Fri, 15 Mar 2024, ksoft@sent.com wrote:
> I am in the process of rewriting in Guile a script that I use
> regularly. Running Guile 3.0.9, when I execute a file containing
>
>   #!/usr/local/bin/guile -s
>   !#
>   (display "Hello, mailing list!")
>   (newline)
>
> the following is printed to standard error:
>
>   ;;; note: source file /Users/me/./test.scm
>   ;;;       newer than compiled /Users/me/.cache/guile/ccache/3.0-LE-8-4.6/Users/me/test.scm.go
>   ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
>   ;;;       or pass the --no-auto-compile argument to disable.
>   ;;; compiling /Users/me/./test.scm
>   ;;; compiled
>   /Users/me/.cache/guile/ccache/3.0-LE-8-4.6/Users/me/test.scm.go

Like the warning says, you ought to either use the GUILE_AUTO_COMPILE
environment variable or use the `--no-auto-compile' switch.
Unfortunately, there is no `--quiet' or `--warning=/dev/null' option.

What I typically do is to compile modules and not compile scripts
(program entrypoints).  So in the end, I have the following prologue for
portable Guile script:

--8<---------------cut here---------------start------------->8---
#!/bin/sh
#-*-Scheme-*-
GUILE="$(command -v guile || command -v guile3.0)"

if [ -z "$GUILE" ]; then
  echo "Missing guile executable."
  exit 1
fi

exec $GUILE --no-auto-compile -e main -s "$0" "$@"
!#
--8<---------------cut here---------------end--------------->8---

Note the usage of `--no-auto-compile' which will prevent Guile from
auto-compiling file, while still loading already compiled modules.

[...]

-- 
Olivier Dion
oldiob.ca



  parent reply	other threads:[~2024-03-15 17:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-15 17:15 Quiet compilation for scripting ksoft
2024-03-15 17:27 ` Tomas Volf
2024-03-15 17:31 ` Olivier Dion [this message]
2024-03-15 17:50   ` tomas
2024-03-15 18:03     ` Olivier Dion
2024-03-15 18:28       ` Keith Wright
2024-03-15 18:51         ` Olivier Dion
2024-03-15 19:00           ` tomas
2024-03-15 20:47             ` Marc Chantreux
2024-03-15 20:52               ` Matt Wette
2024-03-15 21:09                 ` Matt Wette
2024-03-16  6:08                 ` tomas
2024-03-18  4:09                 ` Kevin Mazzarella
2024-03-18 13:40                 ` Matt Wette
2024-03-18 14:31                   ` Matt Wette

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=87bk7f9zb4.fsf@laura \
    --to=olivier.dion@polymtl.ca \
    --cc=guile-user@gnu.org \
    --cc=ksoft@sent.com \
    /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).