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
Issue 11123 - std.getopt should support function callbacks. #1601
Conversation
I expected you'd fix this quickly. Looks good. |
Someone on IRC asked for it, saying they thought that C-style argument handling was supported (meaning "call this function when an argument is passed"). |
It's green, yay. Any objections on pulling this? |
is(typeof(receiver) == delegate) && | ||
enum isCallbackWithLessThanTwoParameters = | ||
(is(typeof(receiver) == delegate) || | ||
is(typeof(*receiver) == function)) && |
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.
You can't put both of these on the same line? The line break seems arbitrary to me, especially when both tests constitute a single "conditional block".
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.
Sure thing.
@@ -504,7 +504,8 @@ void handleOption(R)(string option, R receiver, ref string[] args, | |||
// string receiver | |||
*receiver = to!(typeof(*receiver))(val); | |||
} | |||
else static if (is(typeof(receiver) == delegate)) | |||
else static if (is(typeof(receiver) == delegate) || | |||
is(typeof(*receiver) == function)) |
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.
I'd have thought you'd have done this one too...
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.
I'm trying to make the code consistent, this line will be way too wide compared to the other code that surrounds it.
Issue 11123 - std.getopt should support function callbacks.
http://d.puremagic.com/issues/show_bug.cgi?id=11123