Skip to content

Commit 257e088

Browse files
committed
Move all from experimental to std
1 parent fdfdf1f commit 257e088

File tree

6 files changed

+129
-81
lines changed

6 files changed

+129
-81
lines changed

changelog/std-all.dd

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
`std.experimental.all` has been moved to `std`
2+
3+
`std.experimental.all` allowed the convenient use of all Phobos modules
4+
with one import (`import std.experimental.all`). With this release, this
5+
convenience module has been stabilized and moved to `std`. From now on, the
6+
convenience module can be accessed with `import std`:
7+
8+
---
9+
import std;
10+
void main()
11+
{
12+
10.iota.map!log.sum.writeln;
13+
}
14+
---
15+
16+
For short scripts a lot of imports are often needed to get all the
17+
modules from the standard library.
18+
With this release it's possible to use `import std` for importing the entire
19+
standard library at once. This can be used for fast prototyping or REPLs:
20+
21+
---
22+
import std;
23+
void main()
24+
{
25+
6.iota
26+
.filter!(a => a % 2) // 1 3 5
27+
.map!(a => a * 2) // 2 6 10
28+
.tee!writeln
29+
.sum
30+
.reverseArgs!writefln("Sum: %d"); // 18
31+
}
32+
---
33+
34+
As before, symbol conflicts will only arise if a symbol with collisions is used.
35+
In this case, $(LINK2 $(ROOT)spec/module.html#static_imports, static imports) or
36+
$(LINK2 $(ROOT)spec/module.html#renamed_imports, renamed imports) can be used
37+
to uniquely select a specific symbol.
38+
39+
The baseline cost for `import std`
40+
is less than half a second (varying from system to system) and
41+
work is in progress to reduce this overhead even further.

posix.mak

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ STD_PACKAGES = std $(addprefix std/,\
206206
PACKAGE_std = array ascii base64 bigint bitmanip compiler complex concurrency \
207207
conv csv demangle encoding exception file format \
208208
functional getopt json math mathspecial meta mmfile numeric \
209-
outbuffer parallelism path process random signals socket stdint \
209+
outbuffer package parallelism path process random signals socket stdint \
210210
stdio string system traits typecons uni \
211211
uri utf uuid variant xml zip zlib
212212
PACKAGE_std_experimental = all checkedint typecons

std/experimental/all.d

+2-78
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,5 @@
1-
/++
2-
Convenience file that allows to import entire Phobos in one command.
3-
+/
41
module std.experimental.all;
52

6-
///
7-
@safe unittest
8-
{
9-
import std.experimental.all;
3+
// This module was kept to avoid breaking existing code
104

11-
int len;
12-
const r = 6.iota
13-
.filter!(a => a % 2) // 1 3 5
14-
.map!(a => a * 2) // 2 6 10
15-
.tee!(_ => len++)
16-
.sum
17-
.reverseArgs!format("Sum: %d");
18-
19-
assert(len == 3);
20-
assert(r == "Sum: 18");
21-
}
22-
23-
///
24-
@safe unittest
25-
{
26-
import std.experimental.all;
27-
assert(10.iota.map!(partial!(pow, 2)).sum == 1023);
28-
}
29-
30-
public import std.algorithm;
31-
public import std.array;
32-
public import std.ascii;
33-
public import std.base64;
34-
public import std.bigint;
35-
public import std.bitmanip;
36-
public import std.compiler;
37-
public import std.complex;
38-
public import std.concurrency;
39-
public import std.container;
40-
public import std.conv;
41-
public import std.csv;
42-
public import std.datetime;
43-
public import std.demangle;
44-
public import std.digest;
45-
public import std.encoding;
46-
public import std.exception;
47-
public import std.file;
48-
public import std.format;
49-
public import std.functional;
50-
public import std.getopt;
51-
public import std.json;
52-
public import std.math;
53-
public import std.mathspecial;
54-
public import std.meta;
55-
public import std.mmfile;
56-
public import std.net.curl;
57-
public import std.numeric;
58-
public import std.outbuffer;
59-
public import std.parallelism;
60-
public import std.path;
61-
public import std.process;
62-
public import std.random;
63-
public import std.range;
64-
public import std.regex;
65-
public import std.signals;
66-
public import std.socket;
67-
public import std.stdint;
68-
public import std.stdio;
69-
public import std.string;
70-
public import std.system;
71-
public import std.traits;
72-
public import std.typecons;
73-
//public import std.typetuple; // this module is undocumented and about to be deprecated
74-
public import std.uni;
75-
public import std.uri;
76-
public import std.utf;
77-
public import std.uuid;
78-
public import std.variant;
79-
public import std.xml;
80-
public import std.zip;
81-
public import std.zlib;
5+
public import std;

std/package.d

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/++
2+
Convenience file that allows to import entire Phobos in one command.
3+
+/
4+
module std;
5+
6+
///
7+
@safe unittest
8+
{
9+
import std;
10+
11+
int len;
12+
const r = 6.iota
13+
.filter!(a => a % 2) // 1 3 5
14+
.map!(a => a * 2) // 2 6 10
15+
.tee!(_ => len++)
16+
.sum
17+
.reverseArgs!format("Sum: %d");
18+
19+
assert(len == 3);
20+
assert(r == "Sum: 18");
21+
}
22+
23+
///
24+
@safe unittest
25+
{
26+
import std;
27+
assert(10.iota.map!(partial!(pow, 2)).sum == 1023);
28+
}
29+
30+
public import std.algorithm;
31+
public import std.array;
32+
public import std.ascii;
33+
public import std.base64;
34+
public import std.bigint;
35+
public import std.bitmanip;
36+
public import std.compiler;
37+
public import std.complex;
38+
public import std.concurrency;
39+
public import std.container;
40+
public import std.conv;
41+
public import std.csv;
42+
public import std.datetime;
43+
public import std.demangle;
44+
public import std.digest;
45+
public import std.encoding;
46+
public import std.exception;
47+
public import std.file;
48+
public import std.format;
49+
public import std.functional;
50+
public import std.getopt;
51+
public import std.json;
52+
public import std.math;
53+
public import std.mathspecial;
54+
public import std.meta;
55+
public import std.mmfile;
56+
public import std.net.curl;
57+
public import std.numeric;
58+
public import std.outbuffer;
59+
public import std.parallelism;
60+
public import std.path;
61+
public import std.process;
62+
public import std.random;
63+
public import std.range;
64+
public import std.regex;
65+
public import std.signals;
66+
public import std.socket;
67+
public import std.stdint;
68+
public import std.stdio;
69+
public import std.string;
70+
public import std.system;
71+
public import std.traits;
72+
public import std.typecons;
73+
//public import std.typetuple; // this module is undocumented and about to be deprecated
74+
public import std.uni;
75+
public import std.uri;
76+
public import std.utf;
77+
public import std.uuid;
78+
public import std.variant;
79+
public import std.xml;
80+
public import std.zip;
81+
public import std.zlib;

win32.mak

+2-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ SRC_STD_7= \
154154
std\json.d \
155155
std\parallelism.d \
156156
std\mathspecial.d \
157-
std\process.d
157+
std\process.d \
158+
std\package.d
158159

159160
SRC_STD= \
160161
$(SRC_STD_1) \

win64.mak

+2-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ SRC_STD_7= \
163163
std\json.d \
164164
std\parallelism.d \
165165
std\mathspecial.d \
166-
std\process.d
166+
std\process.d \
167+
std\package.d
167168

168169
SRC_STD= \
169170
$(SRC_STD_1) \

0 commit comments

Comments
 (0)