<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/11/26ef24002e41d7ebabfb7229a3904059"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-11-22T14:28:54"
  subject="Re: Self-detection of native code execution (Was Re: [Caml-list] Accuracy of Gc.stat ())"
  prev="2003/11/92dbb3eff27c1305dfb13cc95807a0c3"
  next="2003/11/6ee5dd7ed01812dc5e6b44c4bdc4eaff"
  prev-in-thread="2003/11/47c7a7b20eb96e9e1835662fe1651255"
  next-in-thread="2003/11/92dbb3eff27c1305dfb13cc95807a0c3"
  prev-thread="2003/11/b9a42a206431fb25d03c3e4bf43cc125"
  next-thread="2003/11/58c657c03c7683b0214401b6eee2a21f"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Accuracy of Gc.stat ()">
<msg 
  url="2003/11/f5ceb88194f4324b692f89b6f3398ff2"
  from="Daniel_Bünzli &lt;daniel.buenzli@e...&gt;"
  author="Daniel_Bünzli"
  date="2003-11-19T17:52:08"
  subject="[Caml-list] Accuracy of Gc.stat ()">
<msg 
  url="2003/11/974acf8ee1bf674c02076f709368a862"
  from="Damien Doligez &lt;damien.doligez@i...&gt;"
  author="Damien Doligez"
  date="2003-11-21T16:45:52"
  subject="Re: [Caml-list] Accuracy of Gc.stat ()">
</msg>
<msg 
  url="2003/11/002147abdef4f6fe5248093cd8c75a75"
  from="Kim Nguyen &lt;nguyen@b...&gt;"
  author="Kim Nguyen"
  date="2003-11-22T00:18:27"
  subject="Re: [Caml-list] Accuracy of Gc.stat ()">
<msg 
  url="2003/11/b0824ff17e581379b1c4a9a60ef71fb5"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-11-22T11:44:11"
  subject="Re: [Caml-list] Accuracy of Gc.stat ()">
<msg 
  url="2003/11/8f2405258c33a120ad0ca9f46f985eb6"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-11-22T11:49:12"
  subject="Re: [Caml-list] Accuracy of Gc.stat ()">
<msg 
  url="2003/11/47c7a7b20eb96e9e1835662fe1651255"
  from="Daniel_Bünzli &lt;daniel.buenzli@e...&gt;"
  author="Daniel_Bünzli"
  date="2003-11-22T14:20:36"
  subject="Self-detection of native code execution (Was Re: [Caml-list] Accuracy of Gc.stat ())">
<msg 
  url="2003/11/26ef24002e41d7ebabfb7229a3904059"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-11-22T14:28:54"
  subject="Re: Self-detection of native code execution (Was Re: [Caml-list] Accuracy of Gc.stat ())">
</msg>
</msg>
<msg 
  url="2003/11/92dbb3eff27c1305dfb13cc95807a0c3"
  from="Kim Nguyen &lt;nguyen@b...&gt;"
  author="Kim Nguyen"
  date="2003-11-22T14:25:55"
  subject="Re: [Caml-list] Accuracy of Gc.stat ()">
<msg 
  url="2003/11/6ee5dd7ed01812dc5e6b44c4bdc4eaff"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-11-22T14:31:14"
  subject="Re: [Caml-list] Accuracy of Gc.stat ()">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
On Sat, Nov 22, 2003 at 03:20:40PM +0100, Daniel B?nzli wrote:
&gt; 
&gt; Le 22 nov. 03, ? 12:49, Richard Jones a ?crit :
&gt; 
&gt; &gt;&gt;Neat trick. This _ought_ to work, but it doesn't for some reason:
&gt; &gt;&gt;
&gt; &gt;&gt;	let arg = (true, false)
&gt; &gt;&gt;	external is_bytecode : bool * bool -&gt; bool = "%field0" "%field1"
&gt; &gt;&gt;
&gt; &gt;&gt;	let () =
&gt; &gt;&gt;	  if is_bytecode arg then
&gt; &gt;&gt;	    print_endline "Bytecode!"
&gt; &gt;&gt;	  else
&gt; &gt;&gt;	    print_endline "Native!"
&gt; &gt;&gt;
&gt; &gt;&gt;Perhaps someone can explain why ...
&gt; 
&gt; Nice try, too bad it doesn't work. I would even prefer that one :
&gt; 
&gt; let arg = true
&gt; external is_bytecode : bool -&gt;  bool = "%identity" "%boolnot"
&gt; 
&gt; let () =
&gt;   if is_bytecode arg then
&gt;     print_endline "Bytecode!"
&gt;   else
&gt;     print_endline "Native!"
&gt; 
&gt; 
&gt; &gt;OK, closer inspection of the manual[*] reveals why this doesn't work.
&gt; &gt;Surely OCaml should flag the above code as a bug, because there are
&gt; &gt;fewer than the magical 6 arguments?
&gt; 
&gt; The strange thing is that the function given by Kim also have fewer 
&gt; than 6 arguments.

True, but his code doesn't actually use the values of the arguments
passed to the C functions.

What is needed is a primitive function which ignores its arguments and
returns a known value. But I don't think there is such a primitive in
the current compiler. (Not as far as I can see by looking at
bytecomp/translcore.ml anyway).

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
"One serious obstacle to the adoption of good programming languages is
the notion that everything has to be sacrificed for speed. In computer
languages as in life, speed kills." -- Mike Vanier

-------------------
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

</contents>

</message>

