D BUGS Part 2
Bill Baxter
wbaxter at gmail.com
Thu Jan 1 19:31:06 PST 2009
On Fri, Jan 2, 2009 at 5:23 AM, bearophile <bearophileHUGS at lycos.com> wrote:
> The first part of this post was posted around October 2 2008, and shows a lits of general bugs I have found in DMD/D.
>
> This post lists several problems/bugs/limits I have found in the write/writefln of D1.
>
> [...]
> As you can see this fixes about 15-20 bugs/troubles with writef/writefln.
I'm not really seeing the place where you pointed out any bugs with
writef/writefln. What you've written seems more like a list of
enhancements than bugs.
Most of the changes seem to be related to this design goal:
> - Unambiguous: the printed data must clearly show the type and content of data.
I think that's a fine goal, but it's clearly not a goal of
writef/writefln. Writefln is more like a typesafe printf with a
little bit of automatic type deduction ability.
This one is great:
> - Structs without toString(): prints their fields in the middle of <>.
It's very annoying to have to go write a custom toString function just
to be able to print out what's inside a struct. It often forces me to
go import std.string to just so I can use std.string.format to print
out a debug representation of a darn two-field struct. Making
writefln automatically generate a default representation of structs
instead of erroring out would be a great.
I also like this one:
> - Strings inside arrays/AAs are printed with "" around them and with special chars escaped. Because sub-items in collections are string-fied using repr and not str.
I once wasted a fair amount of time trying to figure out why something
wasn't working because of not realizing that my array was actually
full of strings and not parsed floats like I was thinking. It sure
looked like an array of floats when I printed it out. Maybe this was
a rare unfortunate interaction between strings, floats, arrays and
auto, though. It hasn't bitten me since then.
--bb
More information about the Digitalmars-d
mailing list