anchor.diff:      static member Change entity = { EcsEventName = "Change"; EcsEventType = EntityEvent entity }
   
   and [<StructuralEquality; NoComparison>] Term =
  +    | Err of string
  +    | B of bool
       | I of int
       | F of single
       | V3 of Vector3
  -    | B3 of Box3
  +    | Box3 of Box3
       | Cmp of IComparable
       | Arb of obj
       | Tag
  
positive.code:         else false
  
  and [<NoEquality; NoComparison>] Subquery =
      | Is of string
      | Of of string * string
      | Eq of string * Term
      | Gt of string * Term
      | Ge of string * Term
      | Lt of string * Term
      | Le of string * Term
      | If of string * (Term -> bool)
      | Intersect of string * Term
      | Or of Subquery list
      | And of Subquery list
      | Not of Subquery
      | It of Subquery * Subquery
      | Let of string * Subquery * Subquery
      | Literal of Term
      | At of string * int
      | Head of string
      | Tail of string
      | ByName of string * string
      | ByType of string * Type
      | Analyze of (Map<string, Term> -> bool)
  
      static member private equalTo term term2 =
          match (term, term2) with
          | (I i, I i2) -> i = i2
          | (F f, F f2) -> f = f2
          | (V3 v, V3 v2) -> v3Eq v v2
          | (B3 b, B3 b2) -> box3Eq b b2
          | (Cmp c, Cmp c2) -> c = c2
          | (Arb o, Arb o2) -> objEq o o2
          | (Label label, Label label2) -> strEq label label2
          | (Labels labels, Labels labels2) -> labels.SetEquals labels2
          | (EcsEntity entity, EcsEntity entity2) -> genEq entity entity2
          | (Terms terms, Terms terms2) ->
              if terms.Length = terms2.Length
              then List.forall2 Subquery.equalTo terms terms2
              else false
          | _ -> false
  
      static member private greaterThan term term2 =
          match (term, term2) with
          | (I i, I i2) -> i > i2
          | (F f, F f2) -> f > f2
          | (Cmp c, Cmp c2) -> c.CompareTo c2 > 0
          | (Terms terms, Terms terms2) ->
              if terms.Length = terms2.Length
              then List.forall2 Subquery.greaterThan terms terms2
              else false
          | (_, _) -> false
  
      static member private greaterEqual term term2 =
          match (term, term2) with
          | (I i, I i2) -> i >= i2
          | (F f, F f2) -> f >= f2
          | (Cmp c, Cmp c2) -> c.CompareTo c2 >= 0
          | (Terms terms, Terms terms2) ->
              if terms.Length = terms2.Length
              then List.forall2 Subquery.greaterEqual terms terms2
              else false
          | (_, _) -> false
  
      static member private lesserThan term term2 =
          match (term, term2) with
          | (I i, I i2) -> i < i2
          | (F f, F f2) -> f < f2
          | (Cmp c, Cmp c2) -> c.CompareTo c2 < 0
          | (Terms terms, Terms terms2) ->
              if terms.Length = terms2.Length
              then List.forall2 Subquery.lesserThan terms terms2
              else false
          | (_, _) -> false
  
      static member private lesserEqual term term2 =
          match (term, term2) with
          | (I i, I i2) -> i <= i2
          | (F f, F f2) -> f <= f2
          | (Cmp c, Cmp c2) -> c.CompareTo c2 <= 0
          | (Terms terms, Terms terms2) ->
              if terms.Length = terms2.Length
              then List.forall2 Subquery.lesserEqual terms terms2
              else false
          | (_, _) -> false
  
      static member private tryEvalTerm (terms : Map<string, Term>) subquery =
          match subquery with
          | Literal term ->
              ValueSome term
          | Head termName ->
              match terms.TryGetValue termName with
              | (true, term) ->
                  match term with
                  | Terms terms ->
                      match terms with
                      | head :: _ -> ValueSome head
                      | _ -> ValueNone
                  | _ -> ValueNone
              | (false, _) -> ValueNone
          | Tail termName ->
              match terms.TryGetValue termName with
              | (true, term) ->
                  match term with
                  | Terms terms ->
                      match terms with
                      | _ :: tail -> ValueSome (Terms tail)
                      | _ -> ValueNone
                  | _ -> ValueNone
              | (false, _) -> ValueNone
          | At (termName, index) ->
              match terms.TryGetValue termName with
              | (true, term) ->
                  match term with
                  | Terms terms ->
                      match Seq.tryItem index terms with
                      | Some item -> ValueSome item
                      | None -> ValueNone
                  | _ -> ValueNone
              | (false, _) -> ValueNone
          | _ -> ValueNone
  
      static member eval (terms : Map<string, Term>) (subquery : Subquery) : bool =
          match subquery with
          | Is termName ->
              terms.ContainsKey termName
          | Of (termName, label2) ->
              match terms.TryGetValue termName with
              | (true, term) ->
                  match term with
                  | Label label -> strEq label label2
                  | Labels labels -> labels.Contains label2
                  | _ -> false
              | (false, _) -> false
          | Eq (termName, term2) ->
              match terms.TryGetValue termName with
              | (true, term) -> Subquery.equalTo term term2
              | (false, _) -> false
          | Gt (termName, term2) ->
              match terms.TryGetValue termName with
              | (true, term) -> Subquery.greaterThan term term2
              | (false, _) -> false
          | Ge (termName, term2) ->
              match terms.TryGetValue termName with
              | (true, term) -> Subquery.greaterEqual term term2
              | (false, _) -> false
          | Lt (termName, term2) ->
              match terms.TryGetValue termName with
              | (true, term) -> Subquery.lesserThan term term2
              | (false, _) -> false
          | Le (termName, term2) ->
              match terms.TryGetValue termName with
              | (true, term) -> Subquery.lesserEqual term term2
              | (false, _) -> false
          | If (termName, pred) ->
              match terms.TryGetValue termName with
              | (true, term) -> pred term
              | (false, _) -> false
          | Intersect (termName, term2) ->
              match terms.TryGetValue termName with
              | (true, term) ->
                  match (term, term2) with
                  | (B3 box, B3 box2) -> box.Intersects box2
                  | (V3 v, B3 box) | (B3 box, V3 v)-> box.Intersects v
                  | (_, _) -> false
              | (false, _) -> false
          | Or subqueries ->
              List.exists (Subquery.eval terms) subqueries
          | Not subquery ->
              not (Subquery.eval terms subquery)
          | And subqueries ->
              List.forall (Subquery.eval terms) subqueries
          | Let (bindingName, subquery, subquery2) ->
              match Subquery.tryEvalTerm terms subquery with
              | ValueSome term ->
                  let terms = Map.add bindingName term terms
                  Subquery.eval terms subquery2
              | ValueNone -> false
          | It (subquery, subquery2) ->
              match Subquery.tryEvalTerm terms subquery with
              | ValueSome term ->
                  let terms = Map.add "it" term terms
                  Subquery.eval terms subquery2
              | ValueNone -> false
          | Literal _ | At (_, _) | Head _ | Tail _ ->
              false
          | ByName (termName, compName2) ->
              match terms.TryGetValue termName with
              | (true, term) ->
                  match term with
                  | Intra (compName, _)  -> strEq compName compName2
                  | Extra (compName, _, _)  -> strEq compName compName2
                  | _ -> false
              | (false, _) -> false
          | ByType (termName, ty2) ->
              match terms.TryGetValue termName with
              | (true, term) ->
                  match term with
                  | Intra (_, ty)  -> refEq ty ty2
                  | Extra (_, ty, _) -> refEq ty ty2
                  | _ -> false
              | (false, _) -> false
          | Analyze analyzer ->
              analyzer terms
  
      static member evalMany (terms : Map<string, Term>) (subqueries : Subquery seq) =
          let mutable result = true
          let mutable subqueryEnr = subqueries.GetEnumerator ()
          while result && subqueryEnr.MoveNext () do
              let subquery = subqueryEnr.Current
              if not (Subquery.eval terms subquery) then
                  result <- false
          result
  
      static member dict entries = dictPlus<string, Subquery> StringComparer.Ordinal entries
      static member singleton subqueryName subquery = Subquery.dict [(subqueryName, subquery)]
      static member zero = []
  
  /// An entity's place in an archetype.
  and [<StructuralEquality; NoComparison; Struct>] ArchetypeSlot =
  
negative.code: 
      do
          for compName in compNames do
              subqueries.Add (Is (Var (Constants.Ecs.IntraComponentPrefix + compName)))
  
      member inline private this.IndexStore<'c when 'c : struct and 'c :> 'c Component> compName archetypeId (stores : Dictionary<string, Store>) =
          match stores.TryGetValue compName with
  