-
Notifications
You must be signed in to change notification settings - Fork 744
[Request] More readable way to set polling interval in After constraint #1866
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
Comments
@CharliePoole I was thinking of using extensions to the integer class to simplify the readability, something like this. What do you think? This should be straightforward but adds extra braces which I don't like :)
|
One of the limitations that I see with the above piece of code is, how will the user of the library know that he can do something like this. because the signature of After would probably be like this,
But this does not expose to the user about how to create an Interval. |
@rvignesh89 I gave this the design label to start with. Our earlier discussion was that we would implement new modifiers:
I think the best solution, if you can implement it, would be to allow only certain sequences at compile time. You could do that using nested classes, derived from AfterConstraint itself.
|
@rvignesh89 Our comments crossed. I am suspicious of adding extensions to basic classes like int. If we do it here it's going to pop up in other places as a user option. And the resulting syntax, as you point out is not that great. What do you think of the nested class idea? |
@CharliePoole I like the idea, but at the moment I'm just not sure how I would do it :) The good part is, it still sticks to the syntax which @mbendtsen originally requested for. So I'm guessing it is more intuitive compared to my idea. I'll give it a try first and see :) |
Remember that you can always do a PR to get code review, even if the work is only partially done. One approach to start would be to convert the existing code to use a nested class for the modifiers, thereby eliminating the problem of duplicate dimensions. Polling interval would then be a second commit. |
This issue is a follow up of #1837 (originally requested by @mbendtsen ) to work on improving the readability of setting a polling interval in the After constraint.
The text was updated successfully, but these errors were encountered: