From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id D99C9BBE1 for ; Thu, 12 Oct 2006 07:18:10 +0200 (CEST) Received: from smtp105.mail.mud.yahoo.com (smtp105.mail.mud.yahoo.com [209.191.85.215]) by discorde.inria.fr (8.13.6/8.13.6) with SMTP id k9C5I9Hj017068 for ; Thu, 12 Oct 2006 07:18:10 +0200 Received: (qmail 9516 invoked from network); 12 Oct 2006 05:18:09 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.ar; h=Received:Subject:From:To:Content-Type:Date:Message-Id:Mime-Version:X-Mailer:Content-Transfer-Encoding; b=O1IhuxQMMTrCjl0YOQ5q4n8ggwsLruG/9k1V2RSKijDoWAU9ejAoBRA+NYZlnHOAeqr0UERRuFjjTq2M/8vvL4YAH51q6sMx/CjIpMF0Wtn2HQwI1Fg0krbqT+30eO3S9YUWlHiae1uqFiGWImV6DyNLo3szJ/9hLQGKcpOlEro= ; Received: from unknown (HELO ?192.168.0.100?) (cpitaper@201.254.106.107 with plain) by smtp105.mail.mud.yahoo.com with SMTP; 12 Oct 2006 05:18:08 -0000 Subject: Why + vs +. but "fake" parametric polymorphism for < From: Carlos Pita To: caml-list@yquem.inria.fr Content-Type: text/plain Date: Thu, 12 Oct 2006 02:18:05 -0300 Message-Id: <1160630285.7649.18.camel@monad> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 452DD011.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; parametric:01 polymorphism:01 ocaml:01 inference:01 parametric:01 polymorphism:01 subtyping:01 compiler:01 bool:01 generality:01 saber:98 respuestas:98 respuestas:98 integer:01 integer:01 Hi all! I would like to implement some number crunching inner loops for dsp stuff with ocaml. I'm a newcomer to the language with strong scheme/python background and trying to come into terms with type inference, parametric polymorphism and structural subtyping. One thing than I'm pretty fond of is the difference between floating point and integer basic mathematical operators. I guess the compiler is able to generate specific and more efficient code for each case without further analysis. But then I found out that comparison operators offer some kind of adhoc polymorphism in the guise of parametric one: # (<);; - : 'a -> 'a -> bool = Is there any reason for this apparently inconsistent design? Would the generality of < be against performance if for example, say, my critical inner loops check against a top limit value thousands of times per second? I'm afraid that the implementation of such a generic operator, which is so different for numerical integer comparison than v.gr for string lexicographical comparison, would incur into some run time overhead. But, as I've said at the beginning, I'm just a newbie and most probably there is a coherent explanation for all this confusion. Thank you in advance. Best regards, Carlos __________________________________________________ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas