-
-
Notifications
You must be signed in to change notification settings - Fork 706
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
Generator implements InputRange interface #5515
Conversation
Thanks for your pull request, @dukc! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Some tips to help speed things up:
Bear in mind that large or tricky changes may require multiple rounds of review and revision. Please see CONTRIBUTING.md for more information. 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. |
18eeb7f
to
5656d9b
Compare
…ement std.range.interfaces.InputRange without having to call inputRangeObject().
5656d9b
to
5983bcc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks OK to my.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good, but I'd suggest adding a few more tests (preferably non-trivial ones). Maybe look at some of the std.range tests for inspiration.
std/concurrency.d
Outdated
@@ -74,6 +74,14 @@ import std.traits; | |||
|
|||
private | |||
{ | |||
import core.atomic; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the un-needed imports? (core.thread, core.sync.mutex, core.sync.condition, std.range.primitives)
std/concurrency.d
Outdated
import core.sync.condition; | ||
import std.range.primitives; | ||
import std.range.interfaces; | ||
import std.traits; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import std.traits: hasElaborateCopyConstructor
std/concurrency.d
Outdated
@@ -1624,6 +1672,7 @@ void yield(T)(T value) | |||
{ | |||
import core.exception; | |||
import std.exception; | |||
import std.range.interfaces; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this import.
std/concurrency.d
Outdated
@@ -1661,14 +1710,49 @@ void yield(T)(T value) | |||
{ | |||
tid.send(e); | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a show stopper but there's no reason to clutter the diff with extraneous whitespace.
std/concurrency.d
Outdated
|
||
// MessageBox Implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this related to the changes in question? If not please remove it.
std/concurrency.d
Outdated
*/ | ||
final T front() @property | ||
{ | ||
return *m_value; | ||
} | ||
|
||
/** | ||
* Returns the most recently generated value without excuting a copy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo executing
std/concurrency.d
Outdated
@@ -1615,7 +1608,7 @@ class Generator(T) : | |||
else | |||
{ | |||
static assert(0, | |||
"Fiber front is rvalue and thus cannot be moved when it defines a postblit."); | |||
"Fiber front is always rvalue and thus cannot be moved if it defines a postblit."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We know here that T defines an elaborate copy constructor so it might be better to mention it by name. Better wording for this message might be:
"Fiber front cannot be moved because " ~ t.stringof ~ " defines a postblit"
Another option is to use a template guard instead, like:
final T moveFront()
if (!hasElaborateCopyConstructor!T)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Template guard won't do since then postblitting fibers would not implement InputRange anymore. I can clarify wording trough.
71793fa
to
13fc6cf
Compare
@wilzbach why hasn't the bot suggested someone from the core team that could review this PMR? Has that functionality been disabled? |
Yes, we disabled it because it was too noisy. IIRC it was only enabled for one week in August 2016: dlang-bots/mention-bot#7 Btw (for contributors) GH now suggests reviewers based on the diff and other information: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks ok to me.
13fc6cf
to
942da35
Compare
Removed the whitespace line from the diff. |
Thanks @JackStouffer and @wilzbach. There's one other one that needs to be looked at when you have some time; it apparently fixes random segfaults in the std.concurrency test suite. Unfortunately I'm not familiar with std.concurrency so I can't review it. |
Reboot of #5309 which is a reboot of #5194.