From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>,
zsh-workers@sunsite.auc.dk
Subject: Re: "getopts" bugs and bad interactions with "shift"
Date: Wed, 24 Nov 1999 17:44:00 +0000 [thread overview]
Message-ID: <991124174400.ZM1627@candle.brasslantern.com> (raw)
In-Reply-To: <199911241150.MAA15227@beta.informatik.hu-berlin.de>
On Nov 24, 12:50pm, Sven Wischnowsky wrote:
} Subject: Re: "getopts" bugs and bad interactions with "shift"
}
} Bart Schaefer wrote:
}
} > ...
} > shift $OPTIND # $((OPTIND-1)) if 3.0.7 or before
} > ...
} > return $ret
}
} I think, when *you* do this kind of stuff, you have a good reason, so:
} why the `$'s (and even `$((...))')? Compatibility with other shells?
Compatibility with my brain, is more like it.
When re-reading a script, I like being able to tell, without having to
think about the context, whether a string is just a string, or is the
name of a parameter. I've never particularly liked the feature that
you can omit the $ in math context, though it almost makes sense in the
case of $[foo] and $((foo)) to not need $[$foo]. ("Almost" because of
this:
zagzig[21] setopt nounset
zagzig[22] echo $foo
zsh: foo: parameter not set
zagzig[23] echo $[foo]
0
I hate not being able to use nounset to detect typographical errors in
parameter names.)
To a lesser extent, it's defensive programming in the sense that if I
don't get used to leaving off the $ in zsh scripts then I won't forget
to use it in plain sh scripts.
Finally, it means I don't have to remember where zsh uses math context
and where it doesn't; and the less I have to remember, the better.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
next prev parent reply other threads:[~1999-11-24 17:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-11-24 11:50 Sven Wischnowsky
1999-11-24 17:44 ` Bart Schaefer [this message]
-- strict thread matches above, loose matches on Subject: below --
1999-11-23 18:08 Bart Schaefer
1999-11-23 18:22 ` Adam Spiers
1999-11-23 21:40 ` Bart Schaefer
1999-11-23 20:36 ` Zefram
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=991124174400.ZM1627@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--cc=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).