Re: [RFD] Expanded Pretty Format Placeholders Proposal
- From
Will Palmer <wmpalmer@gmail.com>
- Date
- Mar 17, 2011, 22:00 UTC
- Message-ID
- <1300399206.2004.22.camel@walleee>
- In-Reply-To
- <7vvczh1lco.fsf@alter.siamese.dyndns.org>
On Thu, 2011-03-17 at 14:35 -0700, Junio C Hamano wrote:
Show 19 quoted lines
> Will Palmer <wmpalmer@gmail.com> writes: > > > On Fri, 2011-03-11 at 00:47 +0000, Will Palmer wrote: > > ... > >> %(foo-condition: %(format: %H, aka %h), %H ) > > > > of course, this conflicts with the need to embed a literal ")" within a > > sub-format. The simplest option for this would be to either allow %) as > > an escape, as with %%. Even simpler, of course, would be %x29, but this > > seems needlessly obscure. The only objection I have to %) is "It's > > ugly". To me, %(format: "this is a paren: )") is easier to read, but > > that would just be moving the problem around, adding the necessity of > > the just-as-ugly-or-moreso %", or alternatively C-style \" and \\. > > So I think that %) will be the best option. > > I somehow had an impression that you will be using "" to quote strings to > protect leading or trailing whitespaces, and if you were to support double > quotes anyway, \" and \\ become a very natural thing to do (so does your > "close parenthesis inside dq").
I do have double-quoted strings implemented, but in trying to break the big-ugly-POC patch down into more-manageable changes, I questioned the need for it when %x20 or the "magic" space-if-nonempty might do just as well for most cases, so I took it out of the initial patch.
I admit that double-quotes do feel quite natural from a C perspective, even if they do go against the conventions we've already established for escaping things in pretty-formats. I'll see about adding double-quoted string support in a single patch in the series, so it can be evaluated independently, and accepted/rejected on its own easily.