Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Accuracy of Gc.stat ()
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel_Bünzli <daniel.buenzli@e...>
Subject: Self-detection of native code execution (Was Re: [Caml-list] Accuracy of Gc.stat ())

Le 22 nov. 03, à 12:49, Richard Jones a écrit :

>> Neat trick. This _ought_ to work, but it doesn't for some reason:
>>
>> 	let arg = (true, false)
>> 	external is_bytecode : bool * bool -> bool = "%field0" "%field1"
>>
>> 	let () =
>> 	  if is_bytecode arg then
>> 	    print_endline "Bytecode!"
>> 	  else
>> 	    print_endline "Native!"
>>
>> Perhaps someone can explain why ...

Nice try, too bad it doesn't work. I would even prefer that one :

let arg = true
external is_bytecode : bool ->  bool = "%identity" "%boolnot"

let () =
   if is_bytecode arg then
     print_endline "Bytecode!"
   else
     print_endline "Native!"


> OK, closer inspection of the manual[*] reveals why this doesn't work.
> Surely OCaml should flag the above code as a bug, because there are
> fewer than the magical 6 arguments?

The strange thing is that the function given by Kim also have fewer 
than 6 arguments.

Daniel

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners