zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: Inconsistency of GLOB_ASSIGN
Date: Thu, 27 Nov 2014 20:43:49 +0000	[thread overview]
Message-ID: <20141127204349.036d3807@pws-pc.ntlworld.com> (raw)
In-Reply-To: <141126215725.ZM13054@torch.brasslantern.com>

On Wed, 26 Nov 2014 21:57:25 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> Yes, I know the reason is that "Config" got expanded first and then taken
> as a variable name in arithmetic evaluation, therefore defaulting to the
> value 0 which was assigned to x.

Ick.

> Still, the following seems wrong to me:
> 
> torch% integer x
> torch% typeset -p x
> typeset -i x=0
> torch% x=*.h
> zsh: bad floating point constant

Yes, I think that if there are expansions using GLOB_ASSIGN --- for which I
think the test that the result is different from the original is good
enough --- we ought to treat it as either a scalar or an array
assignment.  The mixture is stupid.

It would be neater always to do an array assignment, in fact, but
the traditional behaviour is that if there was only one result the
assignment is scalar, and GLOB_ASSIGN is really there only for
tradition.

Arguably we should look at the type of the destination and if it's
numeric not do a glob at all.  I'd be happy with that, since:

integer x
x=3*3

probably doesn't mean "look for files beginning and ending in 3", but maybe it's making the whole thing even more complicated.

I will try to think of a prize to give anyone who can make any language
other than zsh report a floating point error when assigning an array to
an integer.

pws


  reply	other threads:[~2014-11-27 20:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-27  5:57 Bart Schaefer
2014-11-27 20:43 ` Peter Stephenson [this message]
2014-11-27 20:51   ` Bart Schaefer
2014-11-27 21:38   ` Bart Schaefer
2014-11-27 23:00     ` Bart Schaefer
2014-11-28  9:34       ` Peter Stephenson
2014-11-28 18:39         ` Bart Schaefer

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=20141127204349.036d3807@pws-pc.ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.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.
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).