anchor.diff:      "code_change(_OldVsn, State, _Extra) -> {ok, State}."
     ]].
     
  -%% Default methods that Reia objects respond to
  -default_methods(Module) ->
  -  NameString = lists:concat(["reia_string:from_list(\"#<", Module, ">\")"]),
  -  [default_method(Function) || Function <- [
  -    "class() -> {constant, '" ++ atom_to_list(Module) ++ "'}.",
  -    "initialize() -> nil.",
  -    "to_s() -> " ++ NameString ++ ".",
  -    "inspect() -> " ++ NameString ++ ".",
  -    "'_'(Method, _Args) -> throw({error, {Method, \"undefined\"}})."
  -  ]].
  -  
  -%% Parse a default function and return a dict entry for it
  -default_method(String) ->
  -  Form = parse_function(String),
  -  {function, _, Name, _, _} = Form,
  -  {Name, Form}.
  -  
   %% Functions for starting a new object
   start_functions(Module) ->
     [start_function(Module, Function) || Function <- [{"spawn", "start"}, {"spawn_link", "start_link"}]].
  
positive.code:   lists:flatten([
      start_functions(Module),
      default_functions(),
      method_functions(Module, Methods)
    ]).
    
  %% Build a dispatch_method function and functions for each of the mangled methods
  method_functions(Module, Methods) ->
    % Decompose the function clauses for methods into handle_call clauses
    {Clauses, Functions} = process_methods(Module, Methods),
    [build_method_dispatch_function(Clauses)|Functions].
   
  %% Process methods into a list of clauses for dispatch_method and functions
  %% with mangled names for each method
  process_methods(Module, Methods) ->
    FinalMethods = merge_methods(Module, Methods),
    {NewClauses, NewFunctions} = lists:foldl(fun(Method, {Clauses, Functions}) ->
      {Clause, Function} = process_method(Method),
      {[Clause|Clauses], [Function|Functions]}
    end, {[],[]}, FinalMethods),
    {lists:reverse(NewClauses), lists:reverse(NewFunctions)}.
    
  %% Merge default methods with the user-defined ones
  merge_methods(Module, Methods) ->
    MethodDict = lists:foldr(
      fun(Function, Dict) ->
        {function, _Line, Name, _Arity, _Clauses} = Function,
        dict:store(Name, Function, Dict)
      end,
      dict:from_list(default_methods(Module)),
      Methods
    ),
    [Method || {_, Method} <- dict:to_list(MethodDict)].
    
  %% Extract a method into its dispatch_method clause and mangled form
  process_method({function, Line, Name, _Arity, Clauses}) ->
    MangledName = reia_mangle:method(Name),
    DispatcherClause = dispatcher_clause(Name, MangledName, Line),
    Function = {function, Line, MangledName, 3,
      [process_method_clause(Clause) || Clause <- Clauses]
  
negative.code: %% Convert a Reia class definition into a Reia module which conforms to the
  %% gen_server behavior, then load it into the code server
  build({class, _Line, 'Object', _Methods} = Class) ->
    % Object gets special case behavior as it has no ancestor
    reia_module:build(ast(Class));
  build({class, Line, Name, Methods}) ->
    % Generate the methods which are derived from this class's ancestors
    BaseMethods = build_inherited_methods(add_ancestor(dict:new(), 'Object')),
    
    % Generate the method for returning the class of an object
    ClassMethod = parse_function("class() -> {constant, '" ++ atom_to_list(Name) ++ "'}."),
    
    % Merge this class's methods in with its ancestry
    FinalMethods = merge_ancestry([ClassMethod|Methods], BaseMethods),
  
    reia_module:build(ast({class, Line, Name, FinalMethods})).
    
  merge_ancestry(Methods, AncestorMethods) ->
    FinalMethods = lists:foldl(
      fun({function, _, Name, _, _} = Function, Dict) ->
        dict:store(Name, Function, Dict)
      end,
      AncestorMethods,
      Methods
    ),
    [Method || {_, Method} <- dict:to_list(FinalMethods)].
    
  build_inherited_methods(MethodsDict) ->
    Methods = compile_inherited_methods(MethodsDict),
    lists:foldl(
      fun({function, _, Name, _, _} = Function, Dict) ->
        {method, Ancestor, _} = dict:fetch(Name, MethodsDict),
        dict:store(Name, {method, Ancestor, Function}, Dict)
      end,
      dict:new(),
      Methods
    ).
    
  compile_inherited_methods(MethodsDict) ->
    Methods = [Method || {_, {_, _, Method}} <- dict:to_list(MethodsDict)],
  