-
Notifications
You must be signed in to change notification settings - Fork 18k
proposal: errors: add AsOf to the API #56949
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
Comments
I think it's important to point out that |
The proposed name is strange. "as of" is a temporal preposition as in "as of January 2022". |
Yes, in my opinion, before adding generic variants of existing functions and types to the standard library, a general approach to this topic (#48287) should be decided first. |
Duplicate of #51945 |
@seankhliao the proposed implementation is not the same |
@pedro-pessoa proposals are for API changes and some observable behaviour side effects. |
With the introduction of generics, I think it makes sense to have an
AsOf
function in the errors package that will return the wanted error.The API would look like this:
A simple implementation of this func could be
But, with generics, we can have this be implemented without reflection and with an allocation free path
cc: @Jorropo who actually wrote the second implementation of
AsOf
Benchmarks
Results:
The text was updated successfully, but these errors were encountered: