-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Description
One of the most common operations on AbstractDict is updating values in-place, like e.g. d[k] += v or haskey(d, k) ? d[k]+= v : d[k] = v.
It is unlikely that user-code with that idiom will ever get optimized to perform only a single look-up, and previous discussions got stalled on what is the preferred user-facing API.
I propose to introduce a new un-exported but stable and documented intermediate API. Design goal is maximal flexibility, at the cost of arbitrary uglyness. Then, package authors who implement an AbstractDict can specialize this intermediate API to accelerate updates, and package authors who use AbstractDict can implement their favorite beautiful user-facing API that uses the intermediate API.
edit: Excised preliminary proposal to separate comment. If you vote on the issue, use this comment for expressing feelings about the general idea of an intermediate ugly API and the below comment for expressing feelings about the specific preliminary proposal.