[PATCH] D156429: [TableGen] Add new bang operator !format

Paul C. Anagnostopoulos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 28 07:36:14 PDT 2023


Paul-C-Anagnostopoulos added a comment.

In D156429#4542473 <https://reviews.llvm.org/D156429#4542473>, @simon_tatham wrote:

> "new string prefix": if you're talking about Python f-strings, then the brace-based formatting syntax predates those by a long way. You could write `"{0} {1}".format(a, b)` long before you could abbreviate it to `f"{a} {b}"`. But both of those syntaxes agree on writing a literal `{` or `}` by doubling it.
>
> (And yes, I think the idea is that only the braces will ever need to be escaped in literal text, because everything else that's interesting in one of these format strings happens //inside// the braces, where different rules apply.)

Yes, of course, the formatting syntax was invented before the f-strings. {{ and }} it is, then.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156429/new/

https://reviews.llvm.org/D156429



More information about the llvm-commits mailing list