Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: improve ${(q)...}
- X-seq: zsh-workers 26903
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: Re: PATCH: improve ${(q)...}
- Date: Wed, 29 Apr 2009 17:42:37 +0100
- In-reply-to: <090429093553.ZM9854@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <5191.1240937187@xxxxxxx> <090428153749.ZM8596@xxxxxxxxxxxxxxxxxxxxxx> <200904290851.n3T8p3m8013327@xxxxxxxxxxxxxx> <090429093553.ZM9854@xxxxxxxxxxxxxxxxxxxxxx>
Bart Schaefer wrote:
> On Apr 29, 9:51am, Peter Stephenson wrote:
> 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 still can't see how this can have an effect, but I think it's moot
anyway.
> } 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.
(q-) seems harmless and - on its own can be a syntax error as at
present. I can't see any problem with that. All this means as a
precedent is it would probably be better never to add - as a flag on its
own, which I can live with.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author