From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vincent Legoll Subject: Re: environment variable handling cleanup ? Date: Sat, 28 Mar 2020 09:06:27 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:55608) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jI6UK-0003Gr-Lj for guix-devel@gnu.org; Sat, 28 Mar 2020 04:06:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jI6UJ-0001qO-I1 for guix-devel@gnu.org; Sat, 28 Mar 2020 04:06:40 -0400 Received: from mail-io1-xd2e.google.com ([2607:f8b0:4864:20::d2e]:37883) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jI6UJ-0001pU-Dy for guix-devel@gnu.org; Sat, 28 Mar 2020 04:06:39 -0400 Received: by mail-io1-xd2e.google.com with SMTP id q9so12358624iod.4 for ; Sat, 28 Mar 2020 01:06:39 -0700 (PDT) In-Reply-To: List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane-mx.org@gnu.org Sender: "Guix-devel" To: Hartmut Goebel Cc: guix-devel Hello, since no one objected to the idea, I'm going forward with this. On Mon, Mar 23, 2020 at 9:55 AM Hartmut Goebel wrote: > Well, I did not count how often this is used, but (guix built utils > update-env) might benefit from this, to. I don't know if you meant that (guix build utils) was the right place to put those helpers, or if you were hinting me at a place where I can use them, or both. It looks like there is something that they can replace in this file: (wrap-script ... (update-env ...)) But... [reordering email content] > > Another question is the usefulness of the separator parameter, > > as I think all target cases use ":", so hardcoding it would be a > > sensible choice. > > I doubt there is a need for different separators. The path separator is > defined to be ":" in Posix. So I'd suggest to use a hardcoded value. To replace (update-env ...) code, I will need to keep separator as a parameter, since some cases in the match-lambda don't use an hardcoded ":". What should I do there ? Can you clarify ? > > There's also the added (or (getenv ...) "") which is not present in > > all target cases. > > I suggest to default the value to #f (False), since - depending on the > variables semantic - it may make a difference whether the variabel is > empty or actually unset. This is especially true when used within a > programming language like Scheme which has a notion of "False" - which > env-vars do not have. OK, I'll do that, I'll just remove the (or (getenv ...) default-value) as the return value for getenv on a non-existent variable is already #f Thanks -- Vincent Legoll