-
Notifications
You must be signed in to change notification settings - Fork 419
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
Add bigint bool casting #22717
Conversation
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]>
There was a problem hiding this 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!
modules/standard/BigInteger.chpl
Outdated
@@ -557,6 +557,11 @@ module BigInteger { | |||
return new bigint(src); | |||
} | |||
|
|||
@chpldoc.nodoc | |||
inline operator :(src: bool, type toType: bigint): bigint throws { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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]>
In #22715, the request to cast from bool to bigint was requested, so that is being added here.
Closes #22715