anchor.diff:  open System.Collections.Generic
   open Prime
   
  -/// Handle to one of an array of multiplexed components.
  -type OneOf<'t when 't : struct> =
  -    { mutable OneOf : 't }
  -
   /// The base component type of an Ecs.
   type Component =
       abstract RefCount : int with get, set
  +
  +/// A storable reference to a component in its containing array.
  +type [<NoEquality; NoComparison; Struct>] ComponentRef<'t when 't : struct and 't :> Component> =
  +    { ComponentIndex : int
  +      ComponentArr : 't array }
  +
  +    member this.Value
  +        with get () = &this.ComponentArr.[this.ComponentIndex]
  +
  +    member this.Assign value =
  +        this.ComponentArr.[this.ComponentIndex] <- value
  +
  +    static member (<!) (componentRef, value) =
  +        componentRef.ComponentArr.[componentRef.ComponentIndex] <- value
  +
  +    static member (!>) componentRef =
  +        &componentRef.ComponentArr.[componentRef.ComponentIndex]
  +
  +[<RequireQualifiedAccess>]
  +module ComponentRef =
  +
  +    let make index arr =
  +        { ComponentIndex = index
  +          ComponentArr = arr }
  +
  +/// Handle to one of an array of multiplexed components.
  +type Simplex<'t when 't : struct> =
  +    { mutable Simplex : 't }
   
   /// Allows an entity to contain multiple of the same component.
   /// However, it uses a dictionary without a small-object optimization, so this functionality won't get the typical
  
positive.code: type [<NoEquality; NoComparison; Struct>] ComponentMultiplexed<'t when 't : struct> =
      internal
          { mutable RefCount : int
            Entries : Dictionary<Guid, 't OneOf> }
      interface Component with
          member this.RefCount
              with get () = this.RefCount
              and set value = this.RefCount <- value
      member this.Components
          with get () = this.Entries.Values :> 't OneOf IEnumerable
      member this.RegisterComponent (multiId, comp) =
          this.Entries.Add (multiId, { OneOf = comp })
      member this.UnregisterComponent multiId =
          this.Entries.Remove multiId
  
  /// A storable reference to a component in its containing array.
  type [<NoEquality; NoComparison; Struct>] ComponentRef<'t when 't : struct and 't :> Component> =
      { ComponentIndex : int
        ComponentArr : 't array }
  
      member this.Value
          with get () = &this.ComponentArr.[this.ComponentIndex]
  
      member this.Assign value =
          this.ComponentArr.[this.ComponentIndex] <- value
  
      static member (<!) (componentRef, value) =
          componentRef.ComponentArr.[componentRef.ComponentIndex] <- value
  
      static member (!>) componentRef =
          &componentRef.ComponentArr.[componentRef.ComponentIndex]
  
  [<RequireQualifiedAccess>]
  module ComponentRef =
  
      let make index arr =
          { ComponentIndex = index
            ComponentArr = arr }
  
  /// A base system type of an Ecs.
  type [<AbstractClass>] 'w System () =
  
negative.code:     abstract Actualize : 'w Ecs -> 'w -> 'w
      default this.Actualize _ world = world
  
  /// Nu's custom Entity-Component-System implementation.
  /// While this isn't the most efficient ECS, it isn't the least efficient either. Due to the set-associative nature of
  /// modern caches, most cache hits will be of the L2 variety for junctioned components. Uncorrelated components will be
  /// L2-bound as is typical. Degradation of cache-prediction would only occur when a significant number of junctioned
  /// components are very chaotically unregistered in a use-case scenario that the I, the library author, have trouble
  /// even imagining.
  and [<NoEquality; NoComparison>] 'w Ecs () =
  
      let systemsUnordered = dictPlus [] : Dictionary<string, 'w System>
      let systemsOrdered = List () : (string * 'w System) List
      let correlations = dictPlus [] : Dictionary<Guid, string List>
  
      member internal this.Correlations 
          with get () = correlations
  
      member this.Update world =
          Seq.fold
              (fun world (_, system : 'w System) -> system.Update this world)
              world systemsOrdered
  
      member this.PostUpdate world =
          Seq.fold
              (fun world (_, system : 'w System) -> system.PostUpdate this world)
              world systemsOrdered
  
      member this.Actualize world =
          Seq.fold
              (fun world (_, system : 'w System) -> system.Actualize this world)
              world systemsOrdered
  
      member this.AddSystem systemName system =
          systemsUnordered.Add (systemName, system)
          systemsOrdered.Add (systemName, system)
  
      member this.RemoveSystem systemName =
          systemsOrdered.RemoveAll (fun (systemName', _) -> systemName' = systemName) |> ignore
          systemsUnordered.Remove systemName |> ignore
  
      member this.TryGetSystem<'s when 's :> 'w System> systemName =
          match systemsUnordered.TryGetValue systemName with
          | (true, system) ->
              match system with
              | :? 's as systemAsS -> Some systemAsS
              | _ -> None
          | (false, _) -> None
  
      member this.GetSystem<'s when 's :> 'w System> systemName =
          this.TryGetSystem<'s> systemName |> Option.get
  
  /// An Ecs system with just a single component.
  and [<AbstractClass>] SystemSingleton<'t, 'w when 't : struct and 't :> Component> (comp : 't) =
      inherit System<'w> ()
      let mutable comp = comp
      member this.Component with get () = &comp
      type 'w Ecs with
          member this.GetComponentSingleton<'t, 'w when 't : struct and 't :> Component> systemName =
              let systemOpt = this.TryGetSystem<SystemSingleton<'t, 'w>> systemName 
              if Option.isNone systemOpt then failwith ("Could not find expected system '" + systemName + "'.")
              let system = Option.get systemOpt
              &system.Component
  
  /// An Ecs system with components stored by a raw index.
  /// Uncorrelated systems could potentially be processed in parallel.
  type [<AbstractClass>] SystemUncorrelated<'t, 'w when 't : struct and 't :> Component> () =
      inherit System<'w> ()
  
      let mutable components = Array.zeroCreate 32 : 't array
  