Subject: bug#22905: GUILE_INSTALL_LOCALE produces unavoidable noise

From: Zefram <[email-masked]>
Date: Mon, 8 Aug 2016 22:02:29 +0100

Andy Wingo wrote:
>If you would like for me to work on your bugs then I would appreciate it
>if you would keep things constructive.  Thanks :)

I'm sorry that that bit came across badly.  I do appreciate your efforts.

>Serious question tho: what sort of back-compatibility can there be with
>a Guile that only supports latin-1 strings?

I'd expect that almost any program that runs on Guile 1.8 ought to be
portable, with only minimal modifications, to later versions of Guile.
Obviously this wouldn't work the other way round: if a program relies
on 2.0's non-Latin-1 strings then it can't be easily ported back to 1.8.
But lots of programs work fine on 1.8, either not processing non-Latin-1
data or processing it in forms other than the builtin string type.
Scheme was a good programming language long before Unicode came along.

>                                             What property is it that
>you are going for here?

In that bit, I'm going for it being possible for a program to run on
both Guile 1.8 and Guile 2.N while avoiding the new locale warning
from Guile 2.N.  This should be a single program file, starting with a
"#!/usr/bin/guile" line, where /usr/bin/guile may refer to either version
of Guile.  This would be especially relevant for a program originally
written for Guile 1.8, but more generally is relevant for any program
that doesn't need any of 2.0's new capabilities.

The particular problem that arises is that a possible form for a
warning-muffling switch would be a command-line switch that goes on the
#! line.  Any new switch of that nature wouldn't be recognised by Guile
1.8, and would cause an error when attempting to run the program on 1.8.

>What about GUILE_INSTALL_LOCALE=require or something like that?

In the environment?  That's still not controllable by the program.  The
environment is the wrong place for any switch that needs to be the choice
of the program.  Whether to engage with the environmentally-suggested
locale ought to be the choice of the program.

>How would this work?

I imagine a builtin function that returns a truth value saying whether
the Guile framework has emitted a warning before running the program.
Suppose it's called "program-running-with-unclean-output".  Then those
who particularly want clean output can write something like

    (when (program-running-with-unclean-output)
      (error "can't run after warnings"))

This doesn't avoid the warning appearing, but does avoid treating a
run marred by the warning as a successful program run.  The program's
checking code can easily be made portable back to Guile versions lacking
the new function, by using cond-expand, false-if-exception, or other
metaprogramming facilities.

-zefram