Skip to content

Commit 1e7be28

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

File tree

6 files changed

+134
-83
lines changed

6 files changed

+134
-83
lines changed

changelog/std-all.dd

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
5f.iota.map!exp2.sum; // 31
13+
}
14+
---
15+
16+
Scripts and experimental code often use long and frequently changing
17+
lists of imports from the standard library.
18+
19+
With this release it is possible to use `import std;` for importing the entire
20+
standard library at once. This can be used for fast prototyping or REPLs:
21+
22+
---
23+
import std;
24+
void main()
25+
{
26+
6.iota
27+
.filter!(a => a % 2) // 1 3 5
28+
.map!(a => a * 2) // 2 6 10
29+
.tee!writeln // peek into the processed stream
30+
.substitute(6, -6) // 2 -6 10
31+
.mean // (2 - 6 + 10) / 3
32+
.reverseArgs!writefln("Sum: %.2f"); // 2
33+
}
34+
---
35+
36+
As before, symbol conflicts will only arise if a symbol with collisions is used.
37+
In this case, $(LINK2 $(ROOT)spec/module.html#static_imports, static imports) or
38+
$(LINK2 $(ROOT)spec/module.html#renamed_imports, renamed imports) can be used
39+
to uniquely select a specific symbol.
40+
41+
The baseline cost for `import std;`
42+
is less than half a second (varying from system to system) and
43+
work is in progress to reduce this overhead even further.

posix.mak

+2-2
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ 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
212-
PACKAGE_std_experimental = all checkedint typecons
212+
PACKAGE_std_experimental = checkedint typecons
213213
PACKAGE_std_algorithm = comparison iteration mutation package searching setops \
214214
sorting
215215
PACKAGE_std_container = array binaryheap dlist package rbtree slist util

std/experimental/all.d

+4-79
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,6 @@
1-
/++
2-
Convenience file that allows to import entire Phobos in one command.
3-
+/
1+
// This module was kept for now to avoid breaking existing code
2+
// @@@DEPRECATED_2.089@@@
3+
deprecated("use `import std;` instead. This module will be removed with 2.089.")
44
module std.experimental.all;
55

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