Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
August 26, 2013 [Issue 10904] New: "%(%s %)" format string support for std.container.Array too | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=10904 Summary: "%(%s %)" format string support for std.container.Array too Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2013-08-26 14:02:29 PDT --- import std.stdio: writefln; import std.container: Array; void main() { int[10] a1; writefln("%(%d %)", a1); Array!int a2; a2.length = 10; writefln("%(%d %)", a2); } With dmd 2.064alpha it gives a run-time error: std.format.FormatException@...\dmd2\src\phobos\std\format.d(2472): Expected '%s' format specifier for type 'Array!int' -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 27, 2013 [Issue 10904] "%(%s %)" format string support for std.container.Array too | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=10904 hsteoh@quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hsteoh@quickfur.ath.cx --- Comment #1 from hsteoh@quickfur.ath.cx 2013-08-26 22:09:28 PDT --- Hmm. Looking at the code, it seems that %(...%) _should_ be able to support any input range, so if you write writefln("%(...%)", a1[]);, it should work, I think. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 27, 2013 [Issue 10904] "%(%s %)" format string support for std.container.Array too | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=10904 --- Comment #2 from hsteoh@quickfur.ath.cx 2013-08-26 22:11:26 PDT --- OK, confirmed that using opSlice (i.e., a2[]) works. It's not as nice, though. We *could* implement a suitable version of toString that will get picked up by std.format without needing to write []. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 27, 2013 [Issue 10904] "%(%s %)" format string support for std.container.Array too | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=10904 Dmitry Olshansky <dmitry.olsh@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dmitry.olsh@gmail.com --- Comment #3 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2013-08-27 05:19:47 PDT --- (In reply to comment #2) > OK, confirmed that using opSlice (i.e., a2[]) works. > > It's not as nice, though. We *could* implement a suitable version of toString that will get picked up by std.format without needing to write []. Well, that would going way too long in the wrong direction. %(..%) prints ranges, period. Leave containers alone :) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 27, 2013 [Issue 10904] "%(%s %)" format string support for std.container.Array too | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=10904 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID --- Comment #4 from bearophile_hugs@eml.cc 2013-08-27 05:56:43 PDT --- (In reply to comment #3) > Well, that would going way too long in the wrong direction. %(..%) prints > ranges, period. Leave containers alone :) OK, I close down this ER. Thank you for all the answers. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation