Closed rope-hmg closed 1 month ago
Well, I've just re-read the FAQ and noticed there is a section that mentions an entry api. I guess it is more of an issue than I first thought.
As far as ergonomics go I don't think the current proposal offers much over the existing api.
This is outside of the scope of the current proposal.
Following from an earlier issue about this api being quite verbose. I agree with the concerns raised there, but I don't think the proposed solution is great.
Personally I think a particularly elegant solution to this problem is the
entry
api from Rust'sHashMap
. https://doc.rust-lang.org/nightly/std/collections/hash_map/struct.HashMap.html#method.entryHere is an implementation in JS that I use in some projects: https://www.npmjs.com/package/rust-map
The only problem I can think of with this is what happens if someone retains the
Entry
object returned from this call. Maybe it's not actually an issue?