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

Extend definition of trivial to include comparisons #27

Closed
ghost opened this issue Jan 23, 2020 · 3 comments
Closed

Extend definition of trivial to include comparisons #27

ghost opened this issue Jan 23, 2020 · 3 comments
Labels
question Further information is requested

Comments

@ghost
Copy link

ghost commented Jan 23, 2020

It would be nice to allow x => x < 0 and x => x > 0 as trivial functions, with other comparison operators too. These cannot ever throw and don't really need fancy names or parameters.

The boolean operators && and || should be allowed too IMHO.

Note that this does not include all arithmetic expressions, as for example x / y could still throw.

@getify
Copy link
Owner

getify commented Jan 23, 2020

These feel very "not trivial" to me, not in the complexity sense but in the readability sense, especially the comparison operators like >, >=, <, and <=, given how visually similar those are to the => arrow designator.

@getify getify added the question Further information is requested label Jan 23, 2020
@ghost
Copy link
Author

ghost commented Jan 27, 2020

Added a comment under #28 that mostly covers this, but I think it'd be fair to include these in the trivial category because I don't think it's reasonable to have to apply a name or more-complicated parameter name to functions that are just doing comparisons.

@getify
Copy link
Owner

getify commented Jan 27, 2020

I replied in the other thread to explain my thinking around "trivial". The more I think about it the more x => x <= y is absolutely not "trivial" IMO, for the reasons stated there.

@getify getify closed this as completed Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant