There is still room for improvement in terms of the current API design. First, we list concepts and their relations, then we can discuss some new designs.
Concepts
There are some primitive concepts in atlas. They should be on the top-level.
- Generator: A function with operator calls (Select, Subset).
- Strategy: Define the behavior of operators.
- Hook: Provide a callback mechanism for tracing, logging, etc.
However, in the current API, there are some other top-level interfaces model
, tracing
, replay
. These are not primitive concepts. model
is actually an argument of Strategy, tracing
is a special Hook, replay
is a special strategy. We make them as top-level interfaces to provide simplicity, but this also introduces confusion. For example, a random strategy won't use the model argument.
Whether to keep them on top-level is debatable. We can learn from more use cases and make a decision later.
Two modes of the generator
A generator can be used in two modes.
- Iterator mode: The return value is an iterator, so we can enumerate several cases.
- Call mode: The return value is a single value. For example, it will return a random value under the random strategy, the first value under vanilla DFS, and the most likely value under model-based DFS.
In API, we should make these two modes very clear to users.