anchor.diff:              for f in functions do
                   SemanticFunctions.compile f 
   
  -    [<Demo("aaaag")>]
  +    let tryGetSynFunction<'a> (name : string) : Option<obj -> 'a> =
  +        match Globals.tryGetAttributeIndex name with
  +            | Some i ->
  +                match Globals.synDispatchers.[i] with
  +                    | null -> None
  +                    | :? IDispatcher<Scope, 'a> as d ->
  +                        let f = fun (n : obj) -> d.Invoke(n, Scope(null, n))
  +                        Some f
  +                    | _ -> None
  +            | None ->
  +                None
  +    
  +    let getSynFunction<'a> (name : string) : obj -> 'a =
  +        match tryGetSynFunction<'a> name with
  +            | Some f -> f 
  +            | _ -> failwithf "[Ag] could not get syn rule for '%s'" name
  +
  +
  +module NewestAgDemo =
  +
  +    [<AllowNullLiteral>]
  +    type SumScope =
  +        class 
  +            inherit Ag.Implementation.Scope
  +            val mutable public Index : int
  +
  +            member x.ChildScope(child : obj) =
  +                if isNull x.Node then SumScope(null, child, Index = 0)
  +                else SumScope(x, child)
  +
  +            new(p,n) = { inherit Ag.Implementation.Scope(p,n); Index = 0 }
  +        end
  +
  +    type IList =
  +        abstract member Sum : SumScope -> int
  +        abstract member All : SumScope -> list<int>
  + 
  +    type Nil() = 
  +        interface IList with
  +            member x.Sum (s : SumScope) =
  +                s.Index
  +
  +            member x.All (s : SumScope) =
  +                [ s.Index ]
  +
  +    type Cons(head : int, tail : IList) =
  +        interface IList with
  +            member x.Sum s = 
  +                let child = s.ChildScope tail
  +                child.Index <- s.Index + 1
  +                head + tail.Sum(child)
  +
  +
  +            member x.All (s : SumScope) =
  +                let child = s.ChildScope tail
  +                child.Index <- s.Index + 1
  +                head :: tail.All child
  +
  +
  +        member x.Head = head
  +        member x.Tail = tail
  +
  +    [<ReflectedDefinition>]
  +    module SomeSems =
  +        open Ag.Frontend
  +
  +        type IList with
  +            [<Attribute(AttributeKind.Synthesized)>]
  +            member x.Sum() : int = x?Sum()
  +
  +            [<Attribute(AttributeKind.Synthesized)>]
  +            member x.All() : list<int> = x?All()
  +
  +            [<Attribute(AttributeKind.Inherited)>]
  +            member x.Index : int = x?Index
  +
  +            [<Attribute(AttributeKind.Inherited)>]
  +            member x.Bla : int = x?Bla
  +
  +        [<Semantic>]
  +        type Sems =
  +            static member All(n : Nil) : list<int> = 
  +                [n.Index]
  +
  +            static member All(c : Cons) : list<int> = 
  +                c.Head :: c.Tail.All()
  +
  +            static member Sum(n : Nil) : int = 
  +                n.Index
  +
  +            static member Sum(c : Cons) : int = 
  +                c.Head + c.Tail.Sum()
  +
  +            static member Index(r : Root<IList>) =
  +                inh <<= 0
  +
  +            static member Index(c : Cons) =
  +                inh <<= 1 + c.Index
  +
  +            static member Bla(r : Root<IList>) =
  +                inh <<= 0
  +
  +            static member Bla(c : Cons) =
  +                inh <<= 10 + c.Bla
  +
  +    [<Demo("Ag Demo")>]
       let run() =
  -        init()
  -        let all : obj -> list<int>  = Ag.synFunction "All"
  -        let sum : obj -> int        = Ag.synFunction "Sum"
  +        Ag.init()
  +        let all : obj -> list<int>  = Ag.getSynFunction "All"
  +        let sum : obj -> int        = Ag.getSynFunction "Sum"
           let list = Cons(0, Cons(1, Nil()))
  -        Log.line "sum = %A" (sum list)
  -        Log.line "all = %A" (all list)
  +        Log.line "sum [0;1] = %A" (sum list)
  +        Log.line "all [0;1] = %A" (all list)
   
           
   
  
positive.code:                 else Cons(n, long (n-1)) :> IList
  
              let test = long 1000
              let testList = List.init 2000 (fun i -> 2000 - i)
  
              for i in 1..10 do
                  sum test |> ignore
  
negative.code: open System.Collections.Generic
  open System.Reflection
  open System.Reflection.Emit
  open System.Runtime.CompilerServices
  open Microsoft.FSharp.Reflection
  open Microsoft.FSharp.Quotations
  open Microsoft.FSharp.Quotations.Patterns
  