[phobos] datetime review

Denis 2korden at gmail.com
Sat Oct 9 03:46:42 PDT 2010


This is an interesting discussion that I personally find very important.

One of the most annoying things in Phobos is that modules are too
large and by too large I mean they contain lots and lots of stuff that
are loosely related to each other.

I'm strongly against design like that. As a programmer I've been grown
with idea of module separation in mind. At work, we are spending tens
of hours discussing the same problem: code dependency reduction. In
Phobos, it's just a disaster - every module is a monster that heavily
depends or other monsters alike.

I've heard an opinion that it's hard for people to remember too many
modules names. However, they know that you need to import std.array to
use Appender, or std.algorithm to use sort etc. As such, it shouldn't
be any harder for them to import std.algorithm.sort; or import
std.array.appender; Alternatively, they may import std.algorithm.all
and have the whole bulk of features at their disposal, but from my
experience, that's not what is needed anyway. Here is a random import
snippet from my code:

import core.memory : GC;
import core.atomic : cas;
import core.stdc.string : memcpy;
import core.sync.semaphore : Semaphore;

In ddmd, I have

module dmd.expression.Add;
module dmd.expression.And;
module dmd.expression.ArrayLength;
etc

each declaring just *one* method and only imports stuff that that
particular module needs. It helps reducing module dependencies *a
lot*.


More information about the phobos mailing list