From: Vincent Stemen <zsh@hightek.org>
To: zsh-users@sunsite.dk
Subject: Re: typesetting parameters
Date: Mon, 14 Jun 2004 13:24:00 -0500 [thread overview]
Message-ID: <20040614182400.GA6105@quark.hightek.org> (raw)
In-Reply-To: <Pine.LNX.4.44.0406132153360.32342-100000@toltec.zanshin.com>
On Sun, Jun 13, 2004 at 09:58:57PM -0700, Bart Schaefer wrote:
> On Sun, 13 Jun 2004, lists wrote:
>
> > I'm having difficulty understanding why one would define a parameter
> > with typeset before using it.
>
> One probably wouldn't, when interactively typing commands, unless one
> wanted to use the special attributes such as padding, alignment, other
> integer bases, or floating-point precision.
>
> The primary time/place and reason to use typeset is when defining shell
> functions, to create variables that are local to the function scope. When
> you use "local" that's really an alias for typeset.
Not only that, even outside of functions, some expressions such as
variable+=$value
will not always behave as intended if the variable is not typeset. If
it is typeset as an array for example, you can depend on it appending
"$value" to the list. Otherwise it might try to add it as an integer
or append it as a string, depending on it's value.
Regards,
Vincent
--
Vincent Stemen
Avoid the VeriSign/Network Solutions domain registration trap!
Read how Network Solutions (NSI) was involved in stealing our domain name.
http://www.InetAddresses.net
next prev parent reply other threads:[~2004-06-14 18:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-14 2:54 lists
2004-06-14 4:58 ` Bart Schaefer
2004-06-14 18:24 ` Vincent Stemen [this message]
2004-06-15 2:43 ` lists
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=20040614182400.GA6105@quark.hightek.org \
--to=zsh@hightek.org \
--cc=zsh-users@sunsite.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).