On Aug 4, 5:43 pm, Bennett Haselton <[email protected]> wrote:
> But what I'm asking is whether there is some reason that gets() and > cas() aren't written so that they succeed if you call them on a key > that doesn't exist. If the key didn't exist when you called gets(), > and it still doesn't exist when you call cas(), then it "hasn't > changed", so why not just let cas() succeed in that case? It would > save the trouble of having to do two branches of code. I see what you're saying, but it's really just shifting around complication. I think there's a valid distinction between initialization and modification. It otherwise ends up kind of complicating the concept of CAS from "replace a known value in the cache by CAS identifier" to "replace a known value in the cache unless you use the special value of 0 as a CAS identifier and the value does not already exist in the cache."
