anchor.diff:  
                                   (* ** Renamer ** *)
   
  -// Environment for renamer
  -// This object is useful to separate the AST walking from the renaming strategy.
  -// Maybe we could use a single mutable object, instead of creating envs all the time.
  -// TODO: create a real class.
  -[<NoComparison; NoEquality>]
  -type Env = {
  -    // Map from an old variable name to the new one.
  -    map: Map<Ident, Ident>
  -    // Used only for optimizeFrequency.
  -    max: int
  -    // Map from an old function name and function arity to the new name.
  -    fct: Map<Ident, Map<int, Ident>>
  -    // List of names that are still available.
  -    reusable: Ident list
  -    // Whether multiple functions can have the same name (but different arity).
  -    allowOverloading: bool
  -    // Function that decides a name (and returns the new Env).
  -    newId: Env -> Ident -> (Env * string)
  -    // Function called when we enter a function, optionally updates the Env.
  -    enterFunction: Env -> Stmt -> Env
  -    // Used only for alwaysNewName
  -    numberOfUsedIdents: int ref
  -}
  -
  -let alwaysNewName env id =
  -    incr env.numberOfUsedIdents
  -    let newName = sprintf "%04d" !env.numberOfUsedIdents
  +let alwaysNewName (numberOfUsedIdents: int ref) env id =
  +    incr numberOfUsedIdents
  +    let newName = sprintf "%04d" !numberOfUsedIdents
       let env = {env with map = Map.add id newName env.map}
       env, newName
   
  +// TODO: expose this renaming strategy
   let optimizeFrequency env id =
       match env.reusable with
       | [] -> // create a new variable
  
positive.code: open Ast
  open Options.Globals
  
  type RenameMode = Unambiguous | Frequency | Context
  
        (* Contextual renaming *)
  
  // TODO: put contextTable in Env.
  let contextTable = new HashMultiMap<(char*char), int>(HashIdentity.Structural)
  
  // TODO: put forbiddenNames in Env.
  let mutable private forbiddenNames = [ "if"; "in"; "do" ]
  let addForbiddenName(s: string) = forbiddenNames <- s :: forbiddenNames
  
  let reset () =
      contextTable.Clear()
      forbiddenNames <- [ "if"; "in"; "do" ]
  
  // This function is called when all 1-char ident are already used
  
negative.code:         {env with map = Map.add id e env.map; reusable = l}, e
  
  // FIXME: handle 2-letter names
  let optimizeContext contextTable env id =
      let cid = char (1000 + int id)
      let newName = chooseIdent contextTable cid env.reusable
      let l = env.reusable |> List.filter (fun x -> x.[0] <> newName.[0])
      {env with map = Map.add id newName env.map; reusable = l}, newName
  
  