DRAFT - This RFC is still being written up
A targeting object represents a set of rules that need to be evaluated, which outputs the best-fit variation for a particular flag. Rulesets need to be evaluated in priority order. The first matching rule will dictate the resulting output (i.e. the recommended variation).
Evaluation Engine
The ruleset evaluation engine essentially selects the variation in which the first rule is satisfied. It can be defined recursively in 4 lines. Note that the following below is just pseudo-code aimed to illustrate the core logic that is used for flag evaluation.
evaluate(ruleset, fallthrough_variation) :: (Ruleset, Variation) -> Variation if (ruleset is empty) return fallthrough_variation cons {condition, identity, segement, variation} = ruleset.pop() if (<condition> matches <identity | segment>) then return variation return evaluate(ruleset, fallthrough_variation)