All pastes #515585 Raw Edit

fvwm faq cf6

public text v1 · immutable
#515585 ·published 2007-05-28 08:39 UTC
rendered paste body
cf5. This Thomas Adam guy - what does he mean when he says: "it's bad to pollute the environment?"

Well, I admit, this is one thing that I see people do a lot. I'll first start off by saying that generally, there's nothing wrong with declaring environment variables to hold computed values --- that's primarily why this command exists. Where I have a problem with it, is when people start to abuse it.

Take for instance the Colorset command. The correct definition is for people to do something like this:

Colorset 0 fg black, bg darkgrey

... yet, I have seen some people do this:

    SetEnv hilight_colorset 0
    Colorset $[hilight_colorset] fg black, bg darkgrey

    SetEnv normal_colorset 1
    Colorset $[normal_colorset] fg white, bg blue
    

... now stop and think for a moment. What is it that's wrong with the above? Not much, it's easy to see at a glance what colorset does what --- but it's a waste of space in terms of environment allocation. The variable might only ever be used once -- and that's when the Colorsets were declared. What really needs to happen is for a comment (you know -- those things which are used to be really descriptive and meaningful?) to be used. Here's the rewritten definition:

    # Colorset 0 is for hilighted windows (i.e. they have focus)
    Colorset 0 fg black, bg darkgrey

    # Colorset 1 is for inactive windows (i.e. they don't have focus)
    Colorset 1 fg white, bg blue
    

... so much easier, and we're not having to do any interpolation of variables. I've seen some people try and argue the point that such declarations via the use of SetEnvs are there because they have separate files for different facets of their config. Well, myabe, but duh!, the same argument applies for other configuration commands besides Colorsets. Sorry, but that doesn't wash...

Another example I see of a useless use of SetEnvs (UUOS) is people redeclaring their base-location that FVWM looks in. Here's an example:

SetEnv fvwm_home $[HOME]/.fvwm

Again, FVWM already has this environment variable set as $[FVWM_USERDIR].