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

Make Base.checked_add and friends public #57255

Open
LilithHafner opened this issue Feb 4, 2025 · 6 comments
Open

Make Base.checked_add and friends public #57255

LilithHafner opened this issue Feb 4, 2025 · 6 comments
Labels
design Design of APIs or of the language itself maths Mathematical functions

Comments

@LilithHafner
Copy link
Member

No description provided.

@LilithHafner LilithHafner added design Design of APIs or of the language itself maths Mathematical functions labels Feb 4, 2025
@nsajko

This comment has been minimized.

@LilithHafner
Copy link
Member Author

According to the literal definition of the Julia API, it would not be breaking to change Base's using Checked to import Checked which would not break the public Base.Checked or the public Base.Checked.checked_add. I'd like to extend the API to guarantee that Base will continue to define the symbol checked_add directly (e.g. via using Checked or using Checked: checked_add).

Automated tools (e.g. the REPL) will use the literal definition so we should make sure it's accurate. For example:

help?> Base.checked_add
  │ Warning
  │
  │  The following bindings may be internal; they may change or be
  │  removed in future versions:
  │
  │    •  Base.checked_add

  Base.checked_add(x, y)

  Calculates x+y, checking for overflow errors where applicable.

  The overflow protection may impose a perceptible performance penalty.

We should do this with all symbols exported into Base that are intended to be publicly accessible with Base.symbol.

@nsajko

This comment has been minimized.

@LilithHafner
Copy link
Member Author

In that case, the docstring of checked_add should be changed to not use Base.checked_add.

@Priynsh
Copy link
Contributor

Priynsh commented Feb 6, 2025

In that case, the docstring of checked_add should be changed to not use Base.checked_add.

should the docstrings of other functions like checked_sub, checked_mul, etc also be changed?

@nsajko
Copy link
Contributor

nsajko commented Feb 6, 2025

Actually, I agree with Lilith. I think it'd be better to keep the doc strings as-is, considering they've been this way for quite a long time, and just make the bindings public in Base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Design of APIs or of the language itself maths Mathematical functions
Projects
None yet
Development

No branches or pull requests

3 participants