Escaping control in formatting (again)
Denis Shelomovskij
verylonglogin.reg at gmail.com
Sun May 6 04:05:27 PDT 2012
Sorry for wasting your time again, but I'm so silly that I still believe
I was right in previous thread about enabling escaping control in
formatting.
To convince me I'm wrong, pleas write to this thread that this isn't a
desired formatting functionality for you:
---
auto myInterfaces = ["Iface1", "Iface2", "Iface3"];
// %!-s disables escaping
myDFile.writefln(`class C: %(%!-s, %)`, myInterfaces);
---
---
// %!+s enables escaping
debug if(str1 != str2) writefln(`WARNING: %!+s != %!+s`, str1, str2);
---
and current (undocumented) escaping rules a good for you:
1. User has no escaping control.
2. Escaping is enabled only for associative arrays, ranges (not
strings), user-defined types, and all its sub-elements unless a sub
element is a character and is formatted with %c or a struct/class
formatted using its `toString` method.
(it took lot time to understand this rules for me, but this isn't an
issue because if they are good, they will be documented some day)
Original thread (with only mine and Kenji Hara opinions (yes, and one
post from Dmitry who don't know current escaping rules):
http://forum.dlang.org/thread/jn3ibu$tp7$1@digitalmars.com
--
Денис В. Шеломовский
Denis V. Shelomovskij
More information about the Digitalmars-d
mailing list