digital-asset / contingent-claims

Apache License 2.0
5 stars 0 forks source link

Should a successful election stop the recursion of `exercise`? #86

Closed matteolimberto-da closed 1 year ago

matteolimberto-da commented 2 years ago

Currently, exercise is a composition of acquire' and exercise'.

The first function evaluates predicates within a When or Anytime node and continues unfolding only if predicates are true. It also has the following effects:

The latter function checks the sub-trees of Or and Anytime nodes against the input election. When there is a match, it replaces the Or / Anytime node with the elected sub-tree and stops the recursion.

As a consequence of this, whenever an election is made, the effects of acquire' are not applied to the elected sub-tree (because the recursion stops). A user might then be forced to invoke lifecycle immediately following a successful election.

There are two alternative approaches:

It is unclear what is most convenient from a usability perspective.