We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
While going through math code, I see many functions that's usage could be simplified by using generics. this will simplify code like this:
var a, b int = 5, 10 var max int max = int(math.Max(float64(a), float64(b)))
to be just
var a, b int = 5, 10 var max int max = math.Max(a, b)
because Max declaration could become
Max
func Max[T number](x, y T) T {...}
what the number should be needs to be discussed. My proposal is to make it
number
type number interface { ~int | ~uint | ~float32 | ~float64 }
The text was updated successfully, but these errors were encountered:
That would be a backwards incompatible change. In general, see #48287
Sorry, something went wrong.
No branches or pull requests
While going through math code, I see many functions that's usage could be simplified by using generics.
this will simplify code like this:
to be just
because
Max
declaration could becomewhat the
number
should be needs to be discussed. My proposal is to make itThe text was updated successfully, but these errors were encountered: