Why not std.io instead of std.stdio?

dsimcha dsimcha at yahoo.com
Sat Apr 25 11:58:48 PDT 2009


== Quote from Denis Koroskin (2korden at gmail.com)'s article
> Michel Fortin Wrote:
> > While it seems acceptable to use "stdio" in "std.c.stdio", since we're
> > wrapping the C header of the same name, I see little justification in
> > repeating the "std" in the module name for "std.stdio". Why not change
> > it to "std.io"?
> >
> > (same comment apply to other "std.std*" modules)
> >
> > I first noticed the strangeness of this when I was new to D, but today
> > I mistakenly wrote "import std.io;", which felt more natural, is
> > shorter and reads way better than "import std.stdio;", which triggered
> > the question.
> >
> > --
> > Michel Fortin
> > michel.fortin at michelf.com
> > http://michelf.com/
> >
> Nice question!
> I also quite don't understand why Phobos doesn't take advantage of hierarchical
modules structure. For example, I/O is a large cathegory and a lot of elements
belongs to it. Console I/O is just one of example, but there is also network I/O,
DMA etc. I believe it is much better to put each independent element in its own
module (to reduce intermodular dependencies etc). For example, I put each class in
a separate module.
> I believe it makes analyzing source code *a lot* easier.

Because then you have yet more stuff to remember to import.  Stuff that goes
together and is generally used at the same time shoudl be in the same module.



More information about the Digitalmars-d mailing list