active-logic/activelogic-cs

`Do`, `Cont`, `Fail` and `Try`

Closed this issue · 3 comments

In places, AL has object-context functions looking like:

action Do(object arg){ return @void(); }

These functions serve no purpose other than integrating (mostly assignment calls) with expression bodied members, however they are still useful. As part of updating certainties, it would be nice to look into this.

Considerations:

  • These functions do not need an object context. Would be better placed under the status static context, making them widely available (DRY).
  • Although Do is correctly formulated as an action, design-wise likely as not we want done or cont.
  • Certainties generate syntactic overheads. Intentional yes, but they may not be wanted here.
  • Do and Run as separate functions may be good since it clarifies the return type better than prefixing a unary op.
  • With an object or boolean assignment, there is a straightforward conversion from the argument to a status value. We do not always need a resulting status. When we do, a Try function may be nice.

Certainties have improved so, above APIs will return certainties and hopefully explicit conversions can be avoided in most cases.

May open a separate issue for a Try syntax. Does not seem relevant to booleans, only nullable.

Reopening because this needs updating docs

Closing with ref to #66 and #53