So, to print or not to print?
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Tue Apr 26 06:11:44 PDT 2016
On 04/26/2016 08:46 AM, Seb wrote:
> I can out myself as a newcomer (since February) and a lot of stuff in D
> is pretty confusing. For example - a bit related - the separation
> between std.stdio and std.file. At least I expected that I can use
> `writeln` on files :/
Thanks for your insight! Could someone insert an explanation at the top
of both std.file and std.stdio, built from the following point:
Artifacts in std.stdio treat files as complex data repositories that are
opened, read from and/or written to, and closed. Artifacts in std.file
treat a file as a unit, much like shell programs do. With std.file
read/write operations are done at the level of the entire file at once,
and details of opening and closing are implicit.
>> Honestly, I see no value whatsoever in print. writefln already does
>> the same job and in a clearer manner.
>
> Or `writeln(chain(a, b, c).join(','))`.
That's just a terrible argument, sorry. The whole point here is to not
necessitate introducing too many language and library artifacts in order
to print something.
Andrei
More information about the Digitalmars-d
mailing list