anchor.diff:  -module('clojerl.ProcessVal').
   
   -include("clojerl.hrl").
  +-include("clojerl_int.hrl").
   
   -behavior('clojerl.IDeref').
   -behavior('clojerl.IEquiv').
  
positive.code: ?CONSTRUCTOR(Value) ->
    UUID = 'erlang.util.UUID':random(),
    Id   = 'erlang.util.UUID':str(UUID),
    _    = erlang:put(Id, Value),
    #{ ?TYPE => ?M
     , id    => Id
     }.
  
  -spec reset(type(), any()) -> any().
  reset(#{?TYPE := ?M, id := Id}, Value) ->
    _ = erlang:put(Id, Value),
    Value.
  
  -spec destroy(type()) -> ok.
  
negative.code:   <<"#<clojerl.ProcessVal ", Id/binary, ">">>.
  
  deref(#{?TYPE := ?M, id := Id}) ->
    case erlang:get(Id) of
      undefined   -> ?ERROR([<<"No process value available for: ">>, Id]);
      {ok, Value} -> Value
    end.
  
  equiv( #{?TYPE := ?M, id := Id}
       , #{?TYPE := ?M, id := Id}
  