zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: "Zsh hackers list" <zsh-workers@sunsite.auc.dk>
Subject: Re: PATCH: pws-19: minor syntactic innovation
Date: Tue, 01 Jun 1999 10:21:40 +0200	[thread overview]
Message-ID: <9906010821.AA38598@ibmth.df.unipi.it> (raw)
In-Reply-To: ""Andrej Borsenkow""'s message of "Tue, 01 Jun 1999 10:23:48 DFT." <00eb01beabf7$4edde7b0$21c9ca95@mow.siemens.ru>

"Andrej Borsenkow" wrote:
> > What's the parse of something like ${(f)"${"$(typeset)"}"} ?  It doesn't
> > seem to be the `obvious' one -- it appears that the quoted strings are
> > actually nesting, because of the enclosing braces, which is something
> > pretty radically new.  (I may be wrong.)  Is this a good thing?
> 
> No. It breaks the basic shell grammar. The main problem is, it can have
> unexpected side effects when running in sh or ksh compatibility mode - and
> this is definitely bad thing.

This isn't due to the change I made, it simply showed up because of that.
The cause is dquote_parse(), which is doing brace-counting; in other words,
it rejects the second `"' as the end of the quoted string because it
detected the ${.  So this behaviour seems to be entirely deliberate.

I'm not so sure it's either new or wrong.  I discovered in an
initialisation file here,
      if [ -n "${BASH_VERSION:-""}" ]; then
which is obviously for bash rather than zsh (and works in bash, too).  If
the quotes don't parse in a nested fashion, this is meaningless, and
wouldn't parse in zsh because it always matches up braces, including inside
quotes.

Furthermore,
  bash$ echo "${FOO"<RET>
  > 

It's at the continuation prompt, so it's still parsing after the brace,
just like zsh (bash will report an error if it ever gets the remaining
`"}"', though).  sh reports `bad subsitution' at this point, however; but
even so, I can't think offhand of a working piece of sh code which would be
broken by this feature.  The fact that bash works happily as sh tends to
reinforce that view.

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


  reply	other threads:[~1999-06-01  8:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-23 15:15 Peter Stephenson
1999-05-29  8:31 ` Bart Schaefer
1999-05-31 22:41 ` Bart Schaefer
1999-06-01  6:23   ` Andrej Borsenkow
1999-06-01  8:21     ` Peter Stephenson [this message]
1999-06-01 12:52       ` Andrej Borsenkow
1999-06-01  9:56   ` PATCH: pws-19: document " Peter Stephenson
1999-06-01 17:44     ` Bart Schaefer
1999-06-02  8:03       ` Peter Stephenson
1999-06-02  8:44         ` sh compatibility " Andrej Borsenkow
1999-06-02  8:30           ` Peter Stephenson

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=9906010821.AA38598@ibmth.df.unipi.it \
    --to=pws@ibmth.df.unipi.it \
    --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).