-
-
Notifications
You must be signed in to change notification settings - Fork 740
Move std.experimental.all to std #6889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
`std.experimental.all` has been moved to `std` | ||
|
||
`std.experimental.all` allowed the convenient use of all Phobos modules | ||
with one import (`import std.experimental.all;`). With this release, this | ||
convenience module has been stabilized and moved to `std`. From now on, the | ||
convenience module can be accessed with `import std;`: | ||
|
||
--- | ||
import std; | ||
void main() | ||
{ | ||
5f.iota.map!exp2.sum; // 31 | ||
} | ||
--- | ||
|
||
Scripts and experimental code often use long and frequently changing | ||
lists of imports from the standard library. | ||
|
||
With this release it is possible to use `import std;` for importing the entire | ||
standard library at once. This can be used for fast prototyping or REPLs: | ||
|
||
--- | ||
import std; | ||
void main() | ||
{ | ||
6.iota | ||
.filter!(a => a % 2) // 1 3 5 | ||
.map!(a => a * 2) // 2 6 10 | ||
.tee!writeln // peek into the processed stream | ||
.substitute(6, -6) // 2 -6 10 | ||
.mean // (2 - 6 + 10) / 3 | ||
.reverseArgs!writefln("Sum: %.2f"); // 2 | ||
} | ||
--- | ||
|
||
As before, symbol conflicts will only arise if a symbol with collisions is used. | ||
In this case, $(LINK2 $(ROOT)spec/module.html#static_imports, static imports) or | ||
$(LINK2 $(ROOT)spec/module.html#renamed_imports, renamed imports) can be used | ||
to uniquely select a specific symbol. | ||
|
||
The baseline cost for `import std;` | ||
is less than half a second (varying from system to system) and | ||
work is in progress to reduce this overhead even further. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,6 @@ | ||
/++ | ||
Convenience file that allows to import entire Phobos in one command. | ||
+/ | ||
// This module was kept for now to avoid breaking existing code | ||
// @@@DEPRECATED_2.089@@@ | ||
deprecated("use `import std;` instead. This module will be removed with 2.089.") | ||
module std.experimental.all; | ||
|
||
/// | ||
@safe unittest | ||
{ | ||
import std.experimental.all; | ||
|
||
int len; | ||
const r = 6.iota | ||
.filter!(a => a % 2) // 1 3 5 | ||
.map!(a => a * 2) // 2 6 10 | ||
.tee!(_ => len++) | ||
.sum | ||
.reverseArgs!format("Sum: %d"); | ||
|
||
assert(len == 3); | ||
assert(r == "Sum: 18"); | ||
} | ||
|
||
/// | ||
@safe unittest | ||
{ | ||
import std.experimental.all; | ||
assert(10.iota.map!(partial!(pow, 2)).sum == 1023); | ||
} | ||
|
||
public import std.algorithm; | ||
public import std.array; | ||
public import std.ascii; | ||
public import std.base64; | ||
public import std.bigint; | ||
public import std.bitmanip; | ||
public import std.compiler; | ||
public import std.complex; | ||
public import std.concurrency; | ||
public import std.container; | ||
public import std.conv; | ||
public import std.csv; | ||
public import std.datetime; | ||
public import std.demangle; | ||
public import std.digest; | ||
public import std.encoding; | ||
public import std.exception; | ||
public import std.file; | ||
public import std.format; | ||
public import std.functional; | ||
public import std.getopt; | ||
public import std.json; | ||
public import std.math; | ||
public import std.mathspecial; | ||
public import std.meta; | ||
public import std.mmfile; | ||
public import std.net.curl; | ||
public import std.numeric; | ||
public import std.outbuffer; | ||
public import std.parallelism; | ||
public import std.path; | ||
public import std.process; | ||
public import std.random; | ||
public import std.range; | ||
public import std.regex; | ||
public import std.signals; | ||
public import std.socket; | ||
public import std.stdint; | ||
public import std.stdio; | ||
public import std.string; | ||
public import std.system; | ||
public import std.traits; | ||
public import std.typecons; | ||
//public import std.typetuple; // this module is undocumented and about to be deprecated | ||
public import std.uni; | ||
public import std.uri; | ||
public import std.utf; | ||
public import std.uuid; | ||
public import std.variant; | ||
public import std.xml; | ||
public import std.zip; | ||
public import std.zlib; | ||
public import std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/++ | ||
Convenience file that allows to import entire Phobos in one import. | ||
+/ | ||
module std; | ||
|
||
/// | ||
@safe unittest | ||
{ | ||
import std; | ||
|
||
int len; | ||
const r = 6.iota | ||
.filter!(a => a % 2) // 1 3 5 | ||
.map!(a => a * 2) // 2 6 10 | ||
.tee!(_ => len++) | ||
.substitute(6, -6) // 2 -6 10 | ||
.sum | ||
.reverseArgs!format("Sum: %d"); | ||
|
||
assert(len == 3); | ||
assert(r == "Sum: 6"); | ||
} | ||
|
||
/// | ||
@safe unittest | ||
{ | ||
import std; | ||
assert(10.iota.map!(partial!(pow, 2)).sum == 1023); | ||
} | ||
|
||
public import | ||
std.algorithm, | ||
std.array, | ||
std.ascii, | ||
std.base64, | ||
std.bigint, | ||
std.bitmanip, | ||
std.compiler, | ||
std.complex, | ||
std.concurrency, | ||
std.container, | ||
std.conv, | ||
std.csv, | ||
std.datetime, | ||
std.demangle, | ||
std.digest, | ||
std.encoding, | ||
std.exception, | ||
std.file, | ||
std.format, | ||
std.functional, | ||
std.getopt, | ||
std.json, | ||
std.math, | ||
std.mathspecial, | ||
std.meta, | ||
std.mmfile, | ||
std.net.curl, | ||
std.net.isemail, | ||
std.numeric, | ||
std.parallelism, | ||
std.path, | ||
std.process, | ||
std.random, | ||
std.range, | ||
std.regex, | ||
std.signals, | ||
std.socket, | ||
std.stdint, | ||
std.stdio, | ||
std.string, | ||
std.system, | ||
std.traits, | ||
std.typecons, | ||
std.uni, | ||
std.uri, | ||
std.utf, | ||
std.uuid, | ||
std.variant, | ||
std.zip, | ||
std.zlib; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.