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

coerceIn is unnecessary #18

Closed
wkornewald opened this issue Dec 12, 2019 · 2 comments
Closed

coerceIn is unnecessary #18

wkornewald opened this issue Dec 12, 2019 · 2 comments

Comments

@wkornewald
Copy link

wkornewald commented Dec 12, 2019

If I understand coerceIn correctly it does the same thing as num.clamp:
https://api.dartlang.org/stable/2.7.0/dart-core/num/clamp.html

The other two coerce methods do the same thing as min() and max(). Maybe your methods are slightly easier to understand, but min and max are so common in other programming languages that keeping the convention might be more important than introducing a second way to do the same thing. If you still want to keep the methods maybe you could at least change the implementation to use min / max instead of the more verbose comparison.

@simc
Copy link
Owner

simc commented Dec 12, 2019

I did not even know clamp() existed. I'm not sure about how to move forward. Many users come from Kotlin and maybe we should keep some duplicates for them.

This is also related to #10 and #16

@simc
Copy link
Owner

simc commented Jan 6, 2020

We decided to keep some duplicate methods to make finding them easier for new users (for example Kotlin users).

Edit: Tree shaking will remove the unused ones anyway.

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

2 participants