dsimcha wrote:
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article
Walter and I discussed quite a few times the possibility of defining
std.all that publically imports all of std. My experiments show that a
short script importing std.all will compile slower, but not too slow,
compared to a script that only import a few modules.

Vote++.  This would be a nice little convenience when writing small scripts in 
D,
which I actually do quite often because I already know where basic APIs like 
file
I/O are in Phobos and I don't want to learn another API just for small scripts.
This goes along with the scaling down thing I was talking about a few days ago. 
 A
well-designed language and library should be good for both big projects (making
complicated things possible) and small projects (making things simple).  std.all
would be a trivial addition that wouldn't clash with anything else and would
really help Phobos scale down better.

Sounds great. I'm even more encouraged by some brief measurement results. I timed dmd against this program:

void main(){}

Then against this program:

import std.stdio;
void main(){}

Then against this program:

import std.stdio;
void main(){}

For convenience of other testers I'm pasting std.all after this message.

The test machine is a 2.5 years old bottom-of-the-line Ubuntu laptop that seems to be in possession of the secret of immortality. Quiescent average run times:

* 0.23 seconds for the first program

* 0.64 seconds for the second program

* 0.98 seconds for the third program

I assume any program or script would have to include at least one module, and the marginal cost of including all other modules is low enough to be encouraging.

Andrei


module std.all;

public import std.algorithm;
public import std.array;
//public import std.atomics;
public import std.base64;
public import std.bigint;
public import std.bitmanip;
public import std.boxer;
public import std.compiler;
public import std.complex;
public import std.contracts;
public import std.conv;
public import std.cpuid;
public import std.cstream;
public import std.ctype;
public import std.date;
public import std.datebase;
public import std.dateparse;
public import std.demangle;
public import std.encoding;
public import std.file;
public import std.format;
public import std.functional;
public import std.getopt;
public import std.intrinsic;
public import std.iterator;
public import std.json;
//public import std.loader;
public import std.math;
public import std.md5;
public import std.metastrings;
public import std.mmfile;
public import std.numeric;
public import std.outbuffer;
public import std.path;
public import std.perf;
public import std.process;
public import std.random;
public import std.range;
public import std.regex;
public import std.regexp;
public import std.signals;
public import std.socket;
public import std.socketstream;
public import std.stdint;
public import std.stdio;
public import std.stdiobase;
public import std.stream;
public import std.string;
public import std.syserror;
public import std.system;
public import std.traits;
public import std.typecons;
public import std.typetuple;
public import std.uni;
public import std.uri;
public import std.utf;
public import std.variant;
public import std.xml;
public import std.zip;
public import std.zlib;

Reply via email to