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=AWL 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 A655ABBE1 for ; Thu, 12 Oct 2006 16:26:47 +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 k9CEQkpG002391 for ; Thu, 12 Oct 2006 16:26:47 +0200 Received: (qmail 54208 invoked from network); 12 Oct 2006 14:26:46 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.ar; h=Received:Subject:From:To:In-Reply-To:References:Content-Type:Date:Message-Id:Mime-Version:X-Mailer:Content-Transfer-Encoding; b=Dy0Eg5CQklG3wLIAeA7cUS9H5qx1767zxojtqu0X76laCqV9dfokKzu2SOGZEx7jWaRls8AGl8FDCeOwHrbdzR0vmTiTo1XJ66keXZfNSlyaie2t/pCyTIg39KjXOHEJ7Za0mffDz9GMreb1qtIWBIg2+VOE6vHqOJGHRn1Qpc4= ; Received: from unknown (HELO ?192.168.0.100?) (cpitadev@201.254.100.19 with plain) by smtp105.mail.mud.yahoo.com with SMTP; 12 Oct 2006 14:26:45 -0000 Subject: Re: [Caml-list] Why + vs +. but "fake" parametric polymorphism for < From: Carlos Pita To: caml-list In-Reply-To: <452DF46C.802@fmf.uni-lj.si> References: <1160630285.7649.18.camel@monad> <20061012.144518.115907516.garrigue@math.nagoya-u.ac.jp> <1160632737.7649.34.camel@monad> <452DF46C.802@fmf.uni-lj.si> Content-Type: text/plain Date: Thu, 12 Oct 2006 11:26:43 -0300 Message-Id: <1160663203.2517.23.camel@monad> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 452E50A6.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; parametric:01 polymorphism:01 inlined:01 compiler:01 inlining:01 compiler:01 inlined:01 cheers:01 saber:98 respuestas:98 respuestas:98 polymorphic:01 polymorphic:01 caml-list:01 ints:01 > Well, to reiterate Jacques warning, annotating the arguments and then > calling a function which is polymorphic won't magically cause the > polymorphic function to use the non-polymorphic comparisons. > let max a b = if a > b then a else b in print_int (max 2 3);; Ok, I understand. By inspection of code generated for the snippet above one sees that albeit the max function is in fact inlined the compiler won't optimize the comparison for ints. What is to be concluded here, if any? Is the moral of the story that when inlining the compiler won't try further optimizations beyond almost verbatim copy of code for the inlined fragment, which was once and for all generated in isolation without attending to specific contexts of use? So, if this is the case, following the tutorial and your remarks the best bet is to specify types for the arguments when defining a function so the compiler get the chance to optimize it locally. Cheers, 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