|
From: | Hermann Peifer |
Subject: | Re: WHINY_USERS=0 |
Date: | Mon, 26 Oct 2009 11:26:19 +0100 |
User-agent: | Thunderbird 2.0.0.23 (Windows/20090812) |
Aharon Robbins wrote:
It's what programmer types call an "easter egg", meaning an undocumented feature with unusual or interesting behavior, and I intend to keep it that way (but see the gawk.texi file :-). The feature as coded means "if WHINY_USERS exists in the environment, enable the whiny user related features." (There are at least two.) So, the behavior you're seeing is what I wanted. I don't intend to change it. Personally, I think you should use asort or asorti if you want array sorting. The code is much clearer that way.
Aharon,Thanks for the explanations, which confirms my observation that WHINY_USERS=0 isn't enough to unset the variable.
About asort() and asorti(): I use these functions occasionally, but what I actually need most are simply sorted *original* array indices (which almost always have some meaning, like country code, or similar, so I don't want to destroy them). IMO, there is nothing better and cleaner than WHINY_USERS to achieve this gawk behaviour. The built-in asorti() function forces me to copy src array into dest array in order to avoid the loss of original indices. This makes the code more complicated, as I see it.
Anyway: I actually didn't want to start a discussion here. Thanks again for the WHINY_USERS easter egg!.
HermannPS for Tim: You might want to re-visit your WHINY_USERS performance test described in http://awk.info/?tip/whinyUsers
[Prev in Thread] | Current Thread | [Next in Thread] |