From tom@@@k@||ber@ @end|ng |rom gm@||@com  Thu Oct 10 11:00:35 2019
From: tom@@@k@||ber@ @end|ng |rom gm@||@com (Tomas Kalibera)
Date: Thu, 10 Oct 2019 11:00:35 +0200
Subject: [Rd] R-specific environment variables: Naming convention?
In-Reply-To: <CAFDcVCQYRYrsEtE8aVqvbO380US9S-01T39+D89WTQ5DxWUQFg@mail.gmail.com>
References: <CAFDcVCQYRYrsEtE8aVqvbO380US9S-01T39+D89WTQ5DxWUQFg@mail.gmail.com>
Message-ID: <08f627da-acaf-1992-2cb8-a89f65e0d1f4@gmail.com>

In principle, what is documented in Writing R Extensions or in the 
manual pages of the internal help system is "public", including 
environment variables. If it is not documented there, it is not 
"public". In addition, the documentation may say that something is 
experimental, better avoided, etc, so needs to read the context, not 
just "grep" the documentation.

Moreover, it is always better to avoid using environment variables 
whenever possible, even the "public" ones, they may interact with child 
processes one is not aware of and in unexpected ways (including child 
processes spawned by R internally, such as during package checking and 
installation). For the same reason they may be set/re-set/cleared when 
child processes are spawned. They may interact in unexpected ways when 
they impact related things. Debugging issues related to environment 
variables is often hard and time consuming.

If an environment variable name starts with _R, it is an indication that 
it is not "public", but there may be several inconsistencies. One should 
always check the documentation; it is not only about whether the 
variable is "public", but also what is the public behavior - and for 
that one needs the documentation.

Best
Tomas

On 10/10/19 7:09 AM, Henrik Bengtsson wrote:
> In base R, there are lots of environment variables with either prefix
> 'R_' or '_R_', e.g. R_ENABLE_JIT and _R_RNG_VERSION_.  I always
> considered R_* variables to be "public" and _R_*_ ones being
> "internal" but realized I don't have a reference for this.  Is this
> true, or is there another reason? Is the difference between the two
> kinds documented anywhere?
>
> Thank you,
>
> Henrik
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] R-specific environment variables: Naming convention?
Tomas Kalibera