Make imports in std.net.curl local & lazy#5926
Conversation
|
Thanks for your pull request, @wilzbach! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
bbea6e6 to
ca0777a
Compare
| import std.range.primitives; | ||
| import std.encoding : EncodingScheme; | ||
| import std.traits : isSomeChar; | ||
| import std.typecons : Flag, Yes, No, Tuple; |
std/net/curl.d
Outdated
| private Request!T recvReq(T=char, S)(S s) | ||
| { | ||
| import std.socket : Socket; | ||
| static assert (is(S == Socket), "Invalid type used. Use std.socket.Socket."); |
There was a problem hiding this comment.
I really wanted to avoid that there are different imports available during the unittest mode, hence this workaround.
There was a problem hiding this comment.
Ew.
I think this cure is worse than the disease.
std/net/curl.d
Outdated
| chunk_end_function, fnmatch_data, fnmatch_function, cookiejar, postfields); | ||
|
|
||
| foreach (option; tt) | ||
| static foreach (option; tt) |
There was a problem hiding this comment.
I would generally advise against mixing different kinds of changes in one commit.
std/net/curl.d
Outdated
| private enum _defaultDataTimeout = dur!"minutes"(2); | ||
| private auto _defaultDataTimeout() { | ||
| import core.time : dur; | ||
| static res = dur!"minutes"(2); |
There was a problem hiding this comment.
static is now going to make it take up space in TLS (and be initialized for each new thread), for something that should be a manifest constant...
std/net/curl.d
Outdated
| private Request!T recvReq(T=char, S)(S s) | ||
| { | ||
| import std.socket : Socket; | ||
| static assert (is(S == Socket), "Invalid type used. Use std.socket.Socket."); |
There was a problem hiding this comment.
Ew.
I think this cure is worse than the disease.
std/net/curl.d
Outdated
| immutable int status; /// The HTTP status code | ||
| } | ||
|
|
||
| import etc.c.curl : CURLcode; |
There was a problem hiding this comment.
should be at the top of the file
166e5f3 to
91eaa50
Compare
A first step for #5916 - there's still much work to do.