Skip to content
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

a minor changes to improve the readability #1419

Closed
iPazooki opened this issue Sep 7, 2023 · 2 comments
Closed

a minor changes to improve the readability #1419

iPazooki opened this issue Sep 7, 2023 · 2 comments

Comments

@iPazooki
Copy link
Contributor

iPazooki commented Sep 7, 2023

In this ReturnsExtensions.cs file, we are using if (!(minDelay < maxDelay)) which could be changed to if (minDelay >= maxDelay) which is more readable.

@stakx
Copy link
Contributor

stakx commented Sep 11, 2023

@iPazooki, it's a very small change, so probably doesn't warrant extended discussion, just a few points on this:

  • I suspect the intention behind the form !(minDelay < maxDelay) might have been to state the expectation (minDelay < maxDelay must hold), and to then use negation (!) to hint at its violation.

  • Some mathematically inclined people may also prefer the < operator when dealing with numeric intervals or ranges, so e.g. when translating the mathematical constraint a ≤ x < b to a language like C#, they might prefer a <= x && x < b over x >= a && x < b. (See e.g. Times.cs for examples of this.)

That being said, yes, the present condition is a little unwieldy. There's no reason why it absolutely has to stay that way.

@kzu
Copy link
Contributor

kzu commented Sep 21, 2023

Fixed in #1422

@kzu kzu closed this as completed Sep 21, 2023
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

No branches or pull requests

3 participants