From: Duncan <1i5t5.duncan@cox.net>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] Re: [RFC] new vala.eclass
Date: Sun, 26 Aug 2012 22:32:30 +0000 (UTC) [thread overview]
Message-ID: <pan.2012.08.26.22.32.29@cox.net> (raw)
In-Reply-To: 1345928676.9829.13.camel@rook
Alexandre Rostovtsev posted on Sat, 25 Aug 2012 17:04:36 -0400 as
excerpted:
> [[ -n "${VALA_API_VERSION}" ]] || die "VALA_API_VERSION not set"
It's just style, but...
1) [[ ]] manages non-word characters (whitespace, etc) hidden behind
variables, so quotes are only necessary if they appear in string-
literals, not the case here. I know eliminating the quotes is gentoo
policy as I've seen it suggested many times before.
2) Gentoo policy regarding implied -n? I know gentoo policy prefers {}
cuddled varnames to make the varname explicit, but does it prefer
explicit -n as well, since that's implicit test behavior and thus does
not need to be explicitly specified?
To my way of thinking [[ ${var} ]] is even clearer than [[ -n ${var} ]]
since there's only one way to interpret the former and I have to
correctly parse the -n (as opposed to -any-other-letter) given the
latter. They're even listed together in bash's "help test" output, so
are considered to have identical behavior to the point of being listed
together by bash itself.
Incorporating both suggestions:
[[ ${VALA_API_VERSION} ]] || die "VALA_API_VERSION not set"
But regardless of #2, definitely eliminate the quotes inside the [[ ]],
as I've seen that suggested numerous times in other cases. The better
quote handling regarding variables is in fact one of the reasons the
[[ ]] form is preferred to the POSIX compliant [ ] form.
--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman
next prev parent reply other threads:[~2012-08-26 22:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-25 16:09 [gentoo-dev] [RFC] new vala.eclass Alexandre Rostovtsev
2012-08-25 17:25 ` Tomáš Chvátal
2012-08-25 18:29 ` Diego Elio Pettenò
2012-08-25 21:04 ` Alexandre Rostovtsev
2012-08-25 21:45 ` Ulrich Mueller
2012-08-26 6:59 ` Alexandre Rostovtsev
2012-08-26 7:08 ` Alexandre Rostovtsev
2012-08-26 7:20 ` Alexandre Rostovtsev
2012-08-26 22:45 ` Zac Medico
2012-08-26 23:43 ` Alexandre Rostovtsev
2012-08-27 2:45 ` Alexis Ballier
2012-08-27 4:45 ` Alexandre Rostovtsev
2012-08-27 12:19 ` Alexis Ballier
2012-08-26 22:32 ` Duncan [this message]
2012-08-27 1:20 ` Alexandre Rostovtsev
2012-08-27 13:21 ` Alexandre Rostovtsev
2012-09-10 2:09 ` Alexandre Rostovtsev
2012-09-12 20:24 ` Alexandre Rostovtsev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pan.2012.08.26.22.32.29@cox.net \
--to=1i5t5.duncan@cox.net \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox