* A copy/paste buffer
@ 2009-06-26 5:44 Jacques Le Normand
0 siblings, 0 replies; only message in thread
From: Jacques Le Normand @ 2009-06-26 5:44 UTC (permalink / raw)
To: caml-list caml-list
[-- Attachment #1: Type: text/plain, Size: 444 bytes --]
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.
[-- Attachment #2: Type: text/html, Size: 546 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-06-26 5:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-26 5:44 A copy/paste buffer Jacques Le Normand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox