module Serializer(S: sig type status end) =
struct
type status = S.status
- type obj = Obj.t
+ type obj = string * Obj.t
let require1 = ref (fun _ -> assert false (* unknown data*))
let already_registered = ref []
already_registered := tag :: !already_registered;
require1 :=
(fun (tag',data) as x ->
- if tag=tag' then Obj.magic require data else Obj.magic !require1 x);
- Obj.magic (fun x -> tag,x)
+ if tag=tag' then require (Obj.magic data) else !require1 x);
+ (fun x -> tag,Obj.repr x)
let serialize = serialize
let require ~baseuri status =
let dump = require0 ~baseuri in
- List.fold_right (Obj.magic !require1) dump status
+ List.fold_right !require1 dump status
end
let decompile ~baseuri =