You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to understand the reasoning behind the delta argument and the return u64 types. This would not support cases where atomic decrement is desired. Would it be better for the types to be i64 to allow for flexibility?
The text was updated successfully, but these errors were encountered:
That's a good quetsion. Changing the delta and return value type to i64 indeeds give more flexibility and allows the increment operation to also behave as a decrement if the delta is a negative integer.
The reason behind choosing an u64 is that common usage scenarios like counters, timestamps are all positive and this ensures that the operation will not accidentally decreases the value.
Do you have an use case for decrementing?
Do you think adding a decrement function would be sufficient for your use case?
Currently, the signature of the atomic increment is
I would like to understand the reasoning behind the
delta
argument and the returnu64
types. This would not support cases where atomic decrement is desired. Would it be better for the types to bei64
to allow for flexibility?The text was updated successfully, but these errors were encountered: