zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: PATCH: improve ${(q)...}
Date: Wed, 29 Apr 2009 09:35:53 -0700	[thread overview]
Message-ID: <090429093553.ZM9854@torch.brasslantern.com> (raw)
In-Reply-To: <200904290851.n3T8p3m8013327@news01.csr.com>

On Apr 29,  9:51am, Peter Stephenson wrote:
}
} > The proposed patch changes the behavior of nested (q) options rather
} > significantly.  E.g., ${(qqq)${(qq)v}} becomes very different.  This
} > could be important if the resulting string is going to be processed
} > with "eval".
} 
} I don't follow that.  The quotation is present if the inner quotation
} would cause the word to behave differently when unquoted.  Stripping
} multiple levels of quotation should therefore still work.  Or are you
} thinking of things like the example below?

I'm not necessarily thinking of any specific example.  With the current
code, ${(qqq)${(qq)v}} produces "'foo'" which still has single quotes
after one level of quotes is stripped.  If that's combined with another
string that also contains single quotes, whether by directly adjacent
concatenation or by interpolation inside a double-quoted string, etc.,
those quotes might mean something.
 
} I won't rely on my expectation here---it's different with backslash
} quoting anyway.  However, you've certainly spotted a case I hadn't where
} this changes the behaviour.  I can look for different letters...
} Hmm, we could use qQ which is currently meaningless as a sort of
} shorthand for "minimal quoting"...?

What does (qqQQ) mean, then?  Or (qQq)?  It'd probably be better to pick
something that currently isn't even valid syntax, like (q-) ... I was
all set to suggest (q1) (q2) etc. but (q0) already means "split at NULL
bytes and then quote".  However, (q-) raises the question of what (-q)
means, and whether (-) by itself means anything; the only character that
is currently "attached" to a preceding flag is ":" and (q:EXPR:) seems
like overkill.


  reply	other threads:[~2009-04-29 16:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-28 16:46 Peter Stephenson
2009-04-28 22:37 ` Bart Schaefer
2009-04-29  8:51   ` Peter Stephenson
2009-04-29 16:35     ` Bart Schaefer [this message]
2009-04-29 16:42       ` 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=090429093553.ZM9854@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --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).