On Wednesday, 12 November 2014 at 14:59:02 UTC, Andrei Alexandrescu wrote:
$ wc -l std/stdio.d
    4130 std/stdio.d

Looks reasonably sized to me.

I think line count shouldn't be the metric. My simpledisplay.d is almost 6,000 lines, but it compiles lightning fast and makes a small binary. It doesn't import anything in Phobos.

When splitting a module, we need to think about independent functionality with the goal of reducing the total number of imports a program uses. I think local imports generally help more than splitting modules.

So the stdio splitup would probably get the biggest gain by making sure std.format isn't imported unless the user specifically uses it (making sure it is localally imported in writefln but not writeln would probably do it, since they are templates, no need to split the module for this).


Actually, looking at the code, std.format is already a local import, but it is in a plain function in some places, like the private void writefx. Why is that function even there?

std.format is also imported in module scope in std.conv.... which is imported in std.traits.

What a mess.



Bottom line, we shouldn't split up modules for its own sake. It should be done as a step toward the larger goal of cleaning up the import web.

Reply via email to