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

Add bigint bool casting #22717

Merged
merged 3 commits into from
Jul 11, 2023
Merged

Add bigint bool casting #22717

merged 3 commits into from
Jul 11, 2023

Conversation

bmcdonald3
Copy link
Member

@bmcdonald3 bmcdonald3 commented Jul 11, 2023

In #22715, the request to cast from bool to bigint was requested, so that is being added here.

Closes #22715

In chapel-lang#22715, the request to cast from bool to bigint was requested,
so that is being added here.

Signed-off-by: Ben McDonald <[email protected]>
Signed-off-by: Ben McDonald <[email protected]>
Copy link
Member

@lydia-duncan lydia-duncan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the operator argument names, I think this looks good, thanks!

@@ -557,6 +557,11 @@ module BigInteger {
return new bigint(src);
}

@chpldoc.nodoc
inline operator :(src: bool, type toType: bigint): bigint throws {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we've finalized the argument names for operators (since users can't used named arguments when calling operators), but this doesn't seem to match any of the names we've typically used.

It looks like we use t almost universally for the type argument name. The original value argument name varies, but the most frequent one seems to be x, so I'd go with that.

We may choose different names when we do finalize that decision, but again, it shouldn't be breaking

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I can change those. The 2 preceding cast operators use the src and toType here, but it looks like the ones after use x and t.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I missed there were casts above it. I got through 100 different operator declarations and it seemed like it had enough of a pattern to draw that conclusion, at least until we finally getting around to make a general decision (where we would have to actually look at all of them). In any case, thanks for updating them, hopefully we'll have more consistency soon

Signed-off-by: Ben McDonald <[email protected]>
@bmcdonald3 bmcdonald3 merged commit 0c0b0c7 into chapel-lang:main Jul 11, 2023
7 checks passed
@bmcdonald3 bmcdonald3 deleted the bigint-bool branch July 11, 2023 21:40
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

Successfully merging this pull request may close these issues.

Can't cast directly from bool to bigint
2 participants