anchor.diff:      end.
   
   merge_msg({MsgName, PrevFields}, {MsgName, NewFields}, MsgDefs) ->
  -    MsgDef = keyfetch(MsgName, MsgDefs),
  +    MsgDef = keyfetch({msg,MsgName}, MsgDefs),
       {MsgName,
        lists:foldl(
          fun(#field{name=FName, occurrence=repeated}, AccFields) ->
  
positive.code: %% * Add a new_default_msg that sets default values according to
  %%   type (and optionalness) as docoumented on the google web:
  %%   strings="", booleans=false, integers=0, enums=<first value> and so on.
  %%
  %% * Optionally non-crash on type-mismatches spec<-->actual-wire-contents
  %%   Ignore/skip instead of crash?
  
negative.code: -record(field,
          {name, fnum, type, occurrence, opts}).
  
  decode_msg(Bin, MsgName, MsgDefs) ->
      MsgKey = {msg,MsgName},
      Msg    = new_initial_msg(MsgKey, MsgDefs),
      MsgDef = keyfetch(MsgKey, MsgDefs),
      decode_field(Bin, MsgDef, MsgDefs, Msg).
  
  new_initial_msg({msg,MsgName}=MsgKey, MsgDefs) ->
      MsgDef = keyfetch(MsgKey, MsgDefs),
      {MsgName, lists:map(fun(#field{name=FName, occurrence=repeated}) ->
                                  {FName, []};
                             (#field{name=FName, type={msg,_Name}=FMsgKey}) ->
                                  {FName, new_initial_msg(FMsgKey, MsgDefs)};
                             (#field{name=FName}) ->
                                  {FName, undefined}
                          end,
                          MsgDef)}.
  
  decode_field(Bin, MsgDef, MsgDefs, Msg) when size(Bin) > 0 ->
      {Key, Rest} = decode_varint(Bin),
      FieldNum = Key bsr 3,
      WireType = Key band 7,
  