Skip to content

Conversation

@Taskeren
Copy link

KT-83018

Implemented product() for numeric collections like sum()

@fzhinkin
Copy link
Contributor

Assuming that implemented behavior (implicit integer overflow) is what we really want to achieve, the change would require tests and better documentation (detailed description of the behavior + samples) to be accepted. Currently, the code doesn't even compile.

Assuming that implemented behavior (implicit integer overflow) is what we really want to achieve

While implicitly overflowing would be consistent with sum's behavior, with multiplication the value grows significantly faster and it is much easier to hit the overflow. So other options should be considered, at least.

@Taskeren
Copy link
Author

Assuming that implemented behavior (implicit integer overflow) is what we really want to achieve, the change would require tests and better documentation (detailed description of the behavior + samples) to be accepted. Currently, the code doesn't even compile.

Assuming that implemented behavior (implicit integer overflow) is what we really want to achieve

While implicitly overflowing would be consistent with sum's behavior, with multiplication the value grows significantly faster and it is much easier to hit the overflow. So other options should be considered, at least.

Maybe adding another product with return type of Long? what should it be called? productToLong()?

@Taskeren
Copy link
Author

It should now compile, but when I try to add since declaration, it won't compile again. I'm not familiar with it, is it OK for this?
I'll continue to add test cases and more detailed documents later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants