From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id A883CBCE1 for ; Tue, 30 Nov 2004 21:30:21 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iAUKULYk021309 for ; Tue, 30 Nov 2004 21:30:21 +0100 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 VAA23738 for ; Tue, 30 Nov 2004 21:30:21 +0100 (MET) Received: from smtp.unc.edu (smtpsrv11.isis.unc.edu [152.2.1.242]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iAUKUJoa021302 (version=TLSv1/SSLv3 cipher=IDEA-CBC-SHA bits=128 verify=FAIL) for ; Tue, 30 Nov 2004 21:30:20 +0100 Received: from [152.2.131.132] (digitalove-lt-cs.cs.unc.edu [152.2.131.132]) (authenticated bits=0) by smtp.unc.edu (8.12.9/8.12.9) with ESMTP id iAUKTfir005036 for ; Tue, 30 Nov 2004 15:29:41 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v619) Content-Transfer-Encoding: 7bit Message-Id: <9E571848-430E-11D9-AF66-000A95CDFBE4@cs.unc.edu> Content-Type: text/plain; charset=US-ASCII; format=flowed To: caml-list@inria.fr From: Ritesh Kumar Subject: Strange observation on polymorphic '<' Date: Tue, 30 Nov 2004 15:30:04 -0500 X-Mailer: Apple Mail (2.619) X-Miltered: at nez-perce with ID 41ACD85D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41ACD85B.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; kumar:01 ocaml:01 inference:01 ocamlopt:01 compiler:01 integers:01 ...:98 polymorphic:01 ints:01 types:02 seems:03 let:03 let:03 comparison:03 tutorial:04 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: Hi, I saw this on the site http://merjis.com/developers/ocaml_tutorial/ch11 The author says that even if the types of a function (let max a b = if a>b then a else b)which internally uses the '>' operator are known (by type inference) and are found to be ints, the ocamlopt compiler still calls the generic 'greaterthan' function written in C to compare them. This seems rather an over kill when a simple comparison instruction could have done the job. Am I missing something here? Let us assume that the function which internally uses the '<' operator is used only in the context of integers inside the program. Ritesh -- What you see is an illusion... well protected, well cherished only by you.