zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@cambridgesiliconradio.com>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: Re: PATCH: octal in arithmetic expressions
Date: Mon, 15 May 2000 19:20:44 +0100	[thread overview]
Message-ID: <0FUM00JQE5MJSH@la-la.cambridgesiliconradio.com> (raw)
In-Reply-To: "Your message of Mon, 15 May 2000 13:51:09 EDT." <20000515135109.A31551@scowler.net>

> This should make zsh conform to POSIX in this regard.

i.e. $(( 010 )) is treated as 8.

We had this, but removed it because it messed up huge numbers of shell
scripts (including mine) with perfectly reasonable leading zeroes that
never did anyone any harm, and very few people needed octal, and there are
other, less ambiguous ways of specifying it.  Consider for example,

% print -P %D
00-05-15

If you extract bits of this as a string and then try to do math on it, it
falls other if the number is 08 or 09.  This is much more the sort of thing
most zsh users are likely to want to do rather than parsing octal.

It should be settable with some option such as
MATH_MODE_MESSES_UP_CONVERSIONS_FROM_STRING_TO_INTEGER... well, all right,
OCTAL_ZEROES.  As ksh doesn't do this it probably shouldn't be set for
ksh emulation.  Unfortunately there isn't a specific posix emulation mode;
there probably should be.  I suppose it would be OK to set it in sh
emulation, since only sh's trying to be posix-like would have math
evaluation.

-- 
Peter Stephenson <pws@cambridgesiliconradio.com>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


  reply	other threads:[~2000-05-15 18:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-15 17:51 Clint Adams
2000-05-15 18:20 ` Peter Stephenson [this message]
2000-05-15 18:44   ` Clint Adams

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=0FUM00JQE5MJSH@la-la.cambridgesiliconradio.com \
    --to=pws@cambridgesiliconradio.com \
    --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).