-
Notifications
You must be signed in to change notification settings - Fork 1
Description
I have suggested the idea of defining saturation operators in the past (as a joke).
https://discourse.julialang.org/t/rfc-what-should-the-arithmetic-within-the-fixedpointnumbers-be/46697/41
I am beginning to think that as long as such operators are not exported by default, it is not a bad idea to provide them.
julia> const +ᶜᵏᵈ = Base.Checked.checked_add
checked_add (generic function with 11 methods)
julia> Int8(127) +ᶜᵏᵈ Int8(1)
ERROR: OverflowError: 127 + 1 overflowed for type Int8
The biggest concern was the rendering and input of minor Unicode characters, but with the emergence of JuliaMono, the situation has greatly improved over the past three years.
Another concern was that checked
is too long as a suffix. In the so-called C23, it is proposed to use the ckd
prefix for checked arithmetic functions. This gave some justification for the use of the abbreviation ckd
.
I believe that no matter what decision we make regarding issue #9, there is a demand to override the context on a per-operator basis.