Commits

camlspotter committed 94c21ee

eval with parens for literal!

Comments (0)

Files changed (2)

 
 external int : int -> int t = "%identity"
 
-let alert s = ignore (Unsafe.fun_call (Unsafe.variable "alert") [| Unsafe.inject (Js.string s) |])
+let alert s = ignore (Js.Unsafe.fun_call (Js.Unsafe.variable "alert") [| Js.Unsafe.inject (Js.string s) |])
 
 let literal = Js.Unsafe.variable (* Actually this does not work, if I put the definition here. *)
 
 (* A workaround... *)    
-let literal = Js.Unsafe.eval_string
-
-
+let literal s = Js.Unsafe.eval_string (Printf.sprintf "( %s )" s)