caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Carlos Pita <cpitadev@yahoo.com.ar>
To: caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Why + vs +. but "fake" parametric polymorphism for <
Date: Thu, 12 Oct 2006 11:26:43 -0300	[thread overview]
Message-ID: <1160663203.2517.23.camel@monad> (raw)
In-Reply-To: <452DF46C.802@fmf.uni-lj.si>


> 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


  parent reply	other threads:[~2006-10-12 14:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-12  5:18 Carlos Pita
2006-10-12  5:45 ` [Caml-list] " Jacques Garrigue
2006-10-12  5:58   ` Carlos Pita
2006-10-12  6:08     ` Jonathan Roewen
     [not found]       ` <452DF46C.802@fmf.uni-lj.si>
2006-10-12 14:26         ` Carlos Pita [this message]
2006-10-13 11:56       ` Diego Olivier FERNANDEZ PONS
2006-10-13 12:14         ` Gerd Stolpmann
2006-10-13 12:46           ` Diego Olivier FERNANDEZ PONS
2006-10-13 13:01             ` Luc Maranget
2006-10-13 13:15               ` Diego Olivier FERNANDEZ PONS
2006-10-13 13:15               ` skaller
2006-10-13 13:36                 ` Luc Maranget
2006-10-13 13:53             ` Gerd Stolpmann
2006-10-13 14:16               ` Luc Maranget
2006-10-12  5:19 Carlos Pita
2006-10-12  5:41 ` [Caml-list] " Carlos Pita
2006-10-12  5:49   ` Basile STARYNKEVITCH
2006-10-12  5:53   ` Jonathan Roewen
2006-10-12  6:10     ` Carlos Pita

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1160663203.2517.23.camel@monad \
    --to=cpitadev@yahoo.com.ar \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).