Skip to content

Use dfmt on std/concurrency.d#5253

Merged
dlang-bot merged 1 commit intodlang:masterfrom
JackStouffer:concurrency
Mar 22, 2017
Merged

Use dfmt on std/concurrency.d#5253
dlang-bot merged 1 commit intodlang:masterfrom
JackStouffer:concurrency

Conversation

@JackStouffer
Copy link
Contributor

std/concurrency.d uses a non standard style, this brings it into line with the rest of the codebase

used the default dfmt options with some manual fixes.

CC @wilzbach

@JackStouffer JackStouffer added this to the 2.075.0 milestone Mar 8, 2017
@JackStouffer JackStouffer force-pushed the concurrency branch 2 times, most recently from d459865 to 791df1a Compare March 8, 2017 19:47
@Hackerpilot
Copy link
Contributor

Small request: also search for " ~ " in the formatted result and delete it.

@JackStouffer
Copy link
Contributor Author

@Hackerpilot Done

@JackStouffer JackStouffer force-pushed the concurrency branch 5 times, most recently from cb839be to 30b62b5 Compare March 12, 2017 02:03
Copy link
Contributor

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

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

First of all: thanks a lot for doing this and bringing the old module into "Phobos" style!
I found a few of tricky cases for which I wasn't sure if there is really a defined style, but apart from that this LGTM.

{
scope(exit) notified = false;
scope (exit)
notified = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure whether this is defined by the style guide

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix this

auto waiter = new Fiber({ receive(cond, received); }), notifier = new Fiber({
send(cond, sent);
});
waiter.call();
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks a bit weird as newlines are used only for the second Fiber expression

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto


auto r = new Generator!int(
{
auto r = new Generator!int({
Copy link
Contributor

Choose a reason for hiding this comment

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

Again this isn't defined by the style guide

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's consistent with then ending });, so I'm for it

@JackStouffer
Copy link
Contributor Author

@wilzbach Fixed

Copy link
Contributor

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

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

I finally found a bit of time to make another pass through this. I found four small points worth discussing in terms of general Phobos style guidelines as there are many precedents for both variants of each point.
However, if further discussions lead to a consensus on these points, we would run an automatic upgrade procedure anyways.

@JackStouffer I would keep this open for another two or three days. I highly doubt that someone who feels strongly about e.g. synchronized( vs synchronized ( hasn't raised his/her voice yet, but let's better be safe than sorry.

thisInfo.ident.mbox.get((T val) {
static if (T.length)
ret.field = val;
}, (LinkTerminated e) { throw e; }, (OwnerTerminated e) { throw e; }, (Variant val) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would use one for each statement, e.g.

(LinkTerminated e) { throw e; },
(OwnerTerminated e) { throw e; },

but it's already a huge improvement of the status quo!

receiveTimeout( msecs(10), (int x) {}, (Variant x) {} );
} ) );
static assert(__traits(compiles, {
receiveTimeout(msecs(10), (int x) { }, (Variant x) { });
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason why you convert {} to { }?
AFIAK {} is a very common style in Phobos (485 occurrences).

bool register(string name, Tid tid)
{
synchronized( registryLock )
synchronized (registryLock)
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: Should we enforce a whitespace after synchronized within the entire Phobos codebase by adding this to the checks to the posix.mak?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

{
mutex_nothrow.unlock_nothrow();
scope(exit) mutex_nothrow.lock_nothrow();
scope (exit) mutex_nothrow.lock_nothrow();
Copy link
Contributor

Choose a reason for hiding this comment

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

There are 271 occurrences of scope(exit) in Phobos, so maybe we should agree on a common style here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same line if one liner. Apply other rules for block statements to scope when there are multiple lines.

@wilzbach
Copy link
Contributor

(the Dscanner failure is due to the random behavior of std.parallelism and the new Project tester seems to have some configuration issues for now.)

@dlang-bot dlang-bot merged commit 5105f45 into dlang:master Mar 22, 2017
@JackStouffer JackStouffer deleted the concurrency branch March 22, 2017 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants