zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@sunsite.dk>
Subject: Re: Arithmetic expression and TRY_BLOCK_ERROR
Date: Wed, 28 Sep 2005 14:55:30 +0000	[thread overview]
Message-ID: <1050928145530.ZM24311@candle.brasslantern.com> (raw)
In-Reply-To: <20050928084655.GC1384@DervishD>

On Sep 28, 10:46am, DervishD wrote:
}
}     'let variable=0' is shorter ;) I really don't know the reason,
} but I can find this kind of assignment everywhere :-/

I suspect it's simply Peter's preference to always use variables in
a consistent context, i.e., either in math expressions or out, not
some of each.  A possible reason for this is future-proofing.
Suppose you have:

	(( variable = 0 ))	# or any other integer constant

Then later that gets changed to:

	(( variable = othervariable ))

If you had instead written it without the (( )), the meaning of:

	variable=othervariable

is entirely different.

Also, some people prefer the readability of being able to put spaces
around the "=".

However, doing integer/float assignments in math context is marginally
more efficient than doing them as plain assignments.  In a single
command this is probably offset by the overhead of parsing the (( )),
but in a loop it could become important, and if you're in the habit of
always writing the (( )) you won't forget them where they matter.


  reply	other threads:[~2005-09-28 14:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-27 23:41 DervishD
2005-09-28  0:11 ` John Reese
2005-09-28  0:48   ` Will Maier
2005-09-28  1:04     ` John Reese
2005-09-28  8:46   ` DervishD
2005-09-28 14:55     ` Bart Schaefer [this message]
2005-09-29 10:30       ` DervishD

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=1050928145530.ZM24311@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --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).