06-Jun-2013 01:14, Jonathan M Davis пишет:
On Wednesday, June 05, 2013 20:56:12 SomeDude wrote:
On Wednesday, 5 June 2013 at 18:36:34 UTC, David Nadlinger wrote:
It also doesn't utilize template constraints, reinvents
isRandomAccessRange && hasSlicing under a poor name, uses C
printf (!) in the examples, has random 2-3 letter variable
names (dis, dip, di, si) all over the place, …
David
Walter explained that calling printf allowed him not to import
half of std. I think it's a good practice to limit dependencies
to a reasonable minimum. Of course, it's hard to come up with a
general rule as to what "reasonable" means here.
Given that pretty much every program is going to use std.stdio in one form or
another,
Wrong.
I see little point in avoiding using it.
Not pulling in a bunch of unrelated junk.
And since it's an example,
it makes even less sense. I would even argue that using printf is bad
practice. writeln and writefln are properly typesafe, whereas printf is not. If
you really actually _need_ to restrict how much you're importing, then using
printf makes sense, but in general, it really doesn't.
I do agree that examples should use std.stdio writeln definetely not
std.stdio. Importing it with version(unittest) or locally in each
unittest is more sensible option here.
--
Dmitry Olshansky