Gentoo Archives: gentoo-portage-dev

From: Alec Warner <antarus@g.o>
To: gentoo-dev@l.g.o
Cc: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] Re: [gentoo-dev] Re: More general interface to use flags
Date: Sun, 04 Nov 2007 21:55:33
Message-Id: b41005390711041354k451e6ce6pcdd0b52e1855ec6e@mail.gmail.com
1 On 11/4/07, Steve Long <slong@××××××××××××××××××.uk> wrote:
2 > Marijn Schouten (hkBst) wrote:
3 > > the current interface to use flags, useq, usev, use_with, use_enable, as
4 > > defined in /usr/lib/portage/bin/ebuild.sh lacks generality. The common
5 > > thing is testing a use flag and possibly echoing a string, but there is no
6 > > function that implements this common behaviour.
7 > >
8 > > I propose that we add such a function. Proposed name for the function is
9 > > "ifuse".
10 > >
11 > I like the overall API that is enabled (and that it doesn't break anything.)
12 >
13 > > I also propose to add the utility function "ifv" which is useful for
14 > > writing concise and clean code.
15 > >
16 > This one seems a bit light-weight to me, but if it makes your life easier,
17 > why not?
18 >
19 > One minor thing; -n is the default test, so:
20 > [[ $1 ]] is the same as [[ -n $1 ]]
21 > and:
22 > [[ ! $1 ]] is the same as [[ -z $1 ]]
23 > ''help test'' is very revealing, for those who haven't read it. ;-)
24
25 Code Clarity over shortcuts. Use the explicit version.
26 --
27 gentoo-portage-dev@g.o mailing list