Re: [dev] environment variables versus runtime configuration (rc) files versus X resources

From: Charlie Kester <corky1951_AT_comcast.net>
Date: Mon, 3 Nov 2014 14:11:46 -0700

On Mon 03 Nov 2014 at 12:32:25 PDT Greg Reagle wrote:
>I just had a thought that might be of interest to fans of the suckless
>philosophy.
>
>It occurred to me that environment variables can be used to configure a
>program, instead of programming in a parser or extension language into a
>program. Are there any reasons not to just use environment variables?
>Then a rc file could just be a shell script that sets environment
>variables. Do you know of any programs that do this? I assume there
>are disadvantages, but what?

Environment variables are essentially global variables, visible to every
program and not just the one you want to configure.

I wouldn't want to ban their use any more than I would ban the use of global
variables in a C program, because they do have their uses.

But I would prefer to use them only in cases where that visibility to other
programs is the point, as with variables like EDITOR or PAGER.

It's mostly an aesthetic choice, but as someone who was raised on the virtues
of decoupling and encapsulation, I don't like to make any variable more
visible than it has to be.
Received on Mon Nov 03 2014 - 22:11:46 CET

This archive was generated by hypermail 2.3.0 : Mon Nov 03 2014 - 22:24:03 CET