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

Corrected Kernel#Complex's signature #1434

Conversation

sampersand
Copy link
Contributor

This updates Kernel#Complex's signature.

In particular, if the first argument defines .to_c, and no second argument is supplied, it calls and returns that. (In the case where exception: false is given, all exceptions (even Exception itself) that would be thrown by .to_c are swallowed, and nil is returned.)

Two additional variants, for when exception: false is explicitly given, were added. In these cases, the return value is Complex?.

@sampersand
Copy link
Contributor Author

Technically, there could also be an | (untyped, ?untyped, exception: false) -> nil variant, but that seems a bit awkward.

@sampersand sampersand force-pushed the swesterman/23-08-18/update-Kernel#Complex branch from c57a46a to e35c4c7 Compare August 18, 2023 21:27
@sampersand sampersand force-pushed the swesterman/23-08-18/update-Kernel#Complex branch from e35c4c7 to 20ce18a Compare August 18, 2023 21:27
@sampersand
Copy link
Contributor Author

I've added in the | (untyped, ?untyped, exception: false) -> nil variant for completeness

@sampersand
Copy link
Contributor Author

Consolidated in #1445

@sampersand sampersand closed this Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant