Gentoo Archives: gentoo-dev

From: Alec Warner <antarus@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Small review on function return codes and simplicity
Date: Tue, 31 Mar 2009 18:29:32
Message-Id: b41005390903311129p2c6fa394tbbe7e6a50808c63b@mail.gmail.com
In Reply to: [gentoo-dev] Small review on function return codes and simplicity by Donnie Berkholz
1 On Tue, Mar 31, 2009 at 11:05 AM, Donnie Berkholz <dberkholz@g.o> wrote:
2 > I noticed some eclass commits using java-pkg_func-exists() and it's a
3 > lot more complicated than it needs to me. Perhaps not everybody knows
4 > that bash generally gives a return status from functions of the last
5 > command run in that function. So these two things are equivalent:
6
7 Also worst feature ever, Ruby does it too and it sucks :)
8
9 >
10 > java-pkg_func-exists() {
11 > if [[ -n "$(declare -f ${1})" ]]; then
12 > return 0
13 > else
14 > return 1
15 > fi
16 > }
17 >
18 >
19 > java-pkg_func-exists() {
20 > [[ -n "$(declare -f ${1})" ]]
21 > }
22 >
23 >
24 > --
25 > Thanks,
26 > Donnie
27 >
28 > Donnie Berkholz
29 > Developer, Gentoo Linux
30 > Blog: http://dberkholz.wordpress.com
31 >