Hello caml-list,
I want to implement a copy/paste buffer for arbitrary polymorphic variants. Is the following code safe?


"
let buffer  : 'a = Obj.magic (ref None)
   
let _ = buffer := Some `Foo
let _ = buffer := Some `Bar

let _ =
  match !buffer with
      Some (`Bar x) -> print_endline "matches"
    | _ -> ()
"


also, how would I refine the buffer type a little more? Every time I try, I run into the value restriction
cheers
--Jacques L.