zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: "Deborah Ariel Pickett" <debbiep@mail.csse.monash.edu.au>,
	zsh-workers@sunsite.dk
Subject: Re: Word splitting in zsh
Date: Fri, 9 Feb 2001 18:18:18 +0000	[thread overview]
Message-ID: <1010209181818.ZM16052@candle.brasslantern.com> (raw)
In-Reply-To: <000d01c0926a$ce26c590$21c9ca95@mow.siemens.ru>

(Distribution changed to -workers)

On Feb 9, 10:34am, Andrej Borsenkow wrote:
}
} > zagzig% echo $ZSH_VERSION
} > 3.1.9-dev-8
} > zagzig% set "a1 a2 a3" b c
} > zagzig% print -l ${1+"$@"}
} > a1 a2 a3 b c						<-- Yipes!
} 
} Well, this is "correct" *zsh* behaviour. The part after `+' is a word - not
} array. And is taken as single word and is never splitted. What happens here,
} is
} 
} - zsh evaluates "$@" that gives you array with three elements
} - but because of "scalar context" in this case (the best I can call it) array
} is concatenated forming the above value.

Yes, your analysis is correct; the bug is that there should not be a scalar
context there.  The effect of ${NAME:+WORD} and ${NAME:-WORD} should be to
replace the context of NAME with the context of WORD in the event that NAME
is (or not) set.  Put another way, the type of NAME should only determine
the type of the whole ${...} when NAME really is being substituted.

(One could argue, then, that ${NAME:=WORD} should make NAME into an array if
WORD expands to an array.  In fact, there are a number of things that this
would make simpler, though there also may be some things it would break.)

} Even worse, it is inconsistent with everything else - array joining is
} supposed to use IFS ... but it does not in this case.

Well, that ought to be relatively simple to fix, and probably isn't even
widely depended-upon.  Zsh scripts hardly ever bother fooling with IFS,
given all the other ways that one has to chop up strings.

} > I don't know exactly when this bug was introduced, though.
} 
} That is almost inevitable in current implementation.

Yes, but 3.0.6 doesn't *have* the current implementation, and it's got
the same problem as demonstrated for 3.0.8 in my previous message.  So
part of this got introduced quite some time ago, which is what I meant.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


       reply	other threads:[~2001-02-09 18:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <000d01c0926a$ce26c590$21c9ca95@mow.siemens.ru>
2001-02-09 18:18 ` Bart Schaefer [this message]
2001-02-10 20:24   ` PATCH: 3.1.9-dev-8: " Bart Schaefer
2001-02-12  7:38     ` Andrej Borsenkow
2001-02-12 14:12       ` Andrej Borsenkow
2001-02-12 19:38         ` Bart Schaefer
2001-02-13  7:51     ` More incompatibility :-) " Andrej Borsenkow
2001-02-13  9:26       ` Bart Schaefer
2001-02-13  9:57         ` Andrej Borsenkow
2001-02-13 19:33           ` Bart Schaefer
2001-02-14 18:00             ` Peter Stephenson
2001-02-15  6:17               ` Andrej Borsenkow
2001-02-15  8:34                 ` Bart Schaefer
2001-02-15 10:35                   ` More incompatibility (word splitting) Peter Stephenson
2001-02-16  7:43                     ` PATCH: " Bart Schaefer
2001-02-16  8:50                       ` Andrej Borsenkow
2001-02-16 17:03                         ` 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=1010209181818.ZM16052@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=debbiep@mail.csse.monash.edu.au \
    --cc=zsh-workers@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).