From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA11642; Sat, 22 Nov 2003 15:20:36 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA11629 for ; Sat, 22 Nov 2003 15:20:35 +0100 (MET) Received: from mail5.bluewin.ch (mail5.bluewin.ch [195.186.1.207]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hAMEKZ117865 for ; Sat, 22 Nov 2003 15:20:35 +0100 (MET) Received: from [10.0.1.2] (62.203.136.218) by mail5.bluewin.ch (Bluewin AG 7.0.024) id 3FBC808D000543F1; Sat, 22 Nov 2003 14:20:34 +0000 In-Reply-To: <20031122114908.GA11593@redhat.com> References: <1970C334-1AB9-11D8-ADB3-000393DBC266@epfl.ch> <20031122012054.0dbd44e2.nguyen@bk.ru> <20031122114350.GA11531@redhat.com> <20031122114908.GA11593@redhat.com> Mime-Version: 1.0 (Apple Message framework v606) Content-Type: text/plain; charset=ISO-8859-1; format=flowed Message-Id: <0C871798-1CF7-11D8-8FEF-000393DBC266@epfl.ch> Content-Transfer-Encoding: quoted-printable Cc: caml-list@inria.fr From: =?ISO-8859-1?Q?Daniel_B=FCnzli?= Subject: Self-detection of native code execution (Was Re: [Caml-list] Accuracy of Gc.stat ()) Date: Sat, 22 Nov 2003 15:20:40 +0100 To: Richard Jones X-Mailer: Apple Mail (2.606) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 endline:01 endline:01 bug:01 kim:99 bool:01 bool:01 ecrit:01 ocaml:01 bytecode:01 bytecode:01 nov:01 ought:01 fewer:02 fewer:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Le 22 nov. 03, =E0 12:49, Richard Jones a =E9crit : >> Neat trick. This _ought_ to work, but it doesn't for some reason: >> >> let arg =3D (true, false) >> external is_bytecode : bool * bool -> bool =3D "%field0" = "%field1" >> >> let () =3D >> 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 =3D true external is_bytecode : bool -> bool =3D "%identity" "%boolnot" let () =3D 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=20 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