2012年4月24日17:20 Denis Shelomovskij <verylonglogin....@gmail.com>: > On Tuesday, 24 April 2012 at 04:55:34 UTC, kenji hara wrote: >> >> My concern is that the proposal is much complicated and less useful >> for general use cases. >> You can emulate such formatting like follows: > > > IMHO addition of %!+s and %!-s alone and removing %c's magic will only > simplify formatting for the user. It was hard (for me) to understand current > escaping rules because it's undocumented and looks dissonant (for me) > because of the fact that escaping is a part of formatting but user is unable > to control it unless magical %c is used. > > I agree that !', !", and !?* of course aren't commonly used as I have > already written. Personally I don't need them at all. > > But this is a common pattern for me: `xformat("My pets: %(%!-s, %)", > petsAsStrings)`. And "My pets: %(%(%c%), %)" is too complicated, dissonant > and not general (will not work if I'll give it pets as int[] e.g.) that I > never use it. I use `.joiner(", ")` instead and every time I do it I think > that something is really wrong with array formatting in Phobos. > > > -- > Денис В. Шеломовский > Denis V. Shelomovskij
OK. What you want is "How to stop auto-escaping of character (with single quotes) or string (with double quotes) elements inside compound format specifier", right? For the needs, I can propose that adding a feature. If the leading compound format specifier has a '#' flag, like "%#( ... %)", it disables auto-escaping for the elements formatting. writefln(">%(%s, %)<", ["hello", "world"]); // output: >"hello", "world"< writefln(">%#(%s, %)<", ["hello", "world"]); // output: >hello, world< You can format the elements as like outside of compound format specifiers. How about you? Kenji Hara