Skip to content

Make imports in std.net.curl local & lazy #5926

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 2 commits into from
Dec 18, 2017

Conversation

wilzbach
Copy link
Member

A first step for #5916 - there's still much work to do.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @wilzbach!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

import std.range.primitives;
import std.encoding : EncodingScheme;
import std.traits : isSomeChar;
import std.typecons : Flag, Yes, No, Tuple;
Copy link
Member Author

@wilzbach wilzbach Dec 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So when do we get DIP1005? :)

std/net/curl.d Outdated
{
import std.socket : Socket;
static assert (is(S == Socket), "Invalid type used. Use std.socket.Socket.");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really wanted to avoid that there are different imports available during the unittest mode, hence this workaround.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ew.

I think this cure is worse than the disease.

std/net/curl.d Outdated
@@ -4300,7 +4352,7 @@ struct Curl
interleavefunction, chunk_data, chunk_bgn_function,
chunk_end_function, fnmatch_data, fnmatch_function, cookiejar, postfields);

foreach (option; tt)
static foreach (option; tt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
{
import std.socket : Socket;
static assert (is(S == Socket), "Invalid type used. Use std.socket.Socket.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ew.

I think this cure is worse than the disease.

std/net/curl.d Outdated
@@ -4099,15 +4144,16 @@ class HTTPStatusException : CurlException
immutable int status; /// The HTTP status code
}

import etc.c.curl : CURLcode;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be at the top of the file

@wilzbach wilzbach merged commit 550f590 into dlang:master Dec 18, 2017
@wilzbach wilzbach deleted the std-net-curl-lazy branch December 18, 2017 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants