Closed victor-axelsson closed 7 years ago
This should be working. The only exception to this is clearing of lists. Since we have lazy creation when we use evalExpr
and evalCmd
this kind of renders the clearList
unnecessary. At least for now.
For now, I'm going to close this issue because if there should be ay issues with clearList
this issue can be reopened. But preferable a separate issue should be created, beacuse this issue is kind of too big for this separate issue.
About
Implement the following functions in
Context
class:The specification from the paper:
About clearing:
In turn, CLEAR-ELEM uses CLEAR-ANY to clear out any data with a given key, regardless of whether it is of type mapT, listT or regT, and also updates the presence set to include any nested operation IDs, but exclude any operations in deps .
CLEAR-NONE
[..] "or by CLEAR-NONE (which does nothing) if the key is absent."
CLEAR-ANY
The premises of CLEAR-ANY are satisfied by CLEAR-MAP1, CLEAR-LIST1 and CLEAR-REG if the respective key appears in ctx, or by CLEAR-NONE (which does nothing) if the key is absent. As defined by the ASSIGN rule, a register maintains a mapping from operation IDs to values. CLEAR-REG updates a register by removing all operation IDs that appear in deps (i.e., which causally precede the clearing operation), but retaining all operation IDs that do not appear in deps (from assignment operations that are concurrent with the clearing operation).
Clearing maps and lists takes a similar approach: each element of the map or list is recursively cleared using clearElem, and presence sets are updated to exclude deps. Thus, any list elements or map entries whose modifications causally precede the clearing operation will end up with empty presence sets, and thus be considered deleted. Any map or list elements containing operations that are concur- rent with the clearing operation are preserved.