caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ritesh Kumar <ritesh@cs.unc.edu>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Strange observation on polymorphic '<'
Date: Fri, 3 Dec 2004 02:24:58 -0500	[thread overview]
Message-ID: <6FBBD2B0-44FC-11D9-AF66-000A95CDFBE4@cs.unc.edu> (raw)
In-Reply-To: <281F644B-43EF-11D9-BA22-000D9345235C@inria.fr>

Oh sure... but I was of the mind that if you had a polymorphic function 
which on certain types have extremely small (one instruction) size (as 
is the case with the '>' operator) then it makes sense to inline that 
function at a point where it is invoked with that type.
For eg. given the code
============
let max a b = if a>b then a else b;;
print_int (max 2 3);;
============
Separate compilation means that the function max should use the C call 
(for the toplevel module). However, the invocation of max 2 3 shouldn't 
use a direct call to the function in the same module as the invocation 
is in the same module (i.e. there is opportunity to optimize it based 
on the known invocation types). Secondly, does separate compilation 
make that strong a sense in case of native compilation for OcaML ... 
most probably not because it anyways generates a standalone executable?

Ritesh
P.S. Sorry Damien for the duplicate...
--
What you see is an illusion... well protected, well cherished only by 
you.

On Dec 1, 2004, at 6:17 PM, Damien Doligez wrote:

> On 30 Nov 2004, at 21:30, Ritesh Kumar wrote:
>
>> 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.
>
> You are missing this: because of separate compilation the compiler has 
> no
> way to know whether the function will only be used on integers in your
> program.  When it compiles the function, it doesn't know what it will
> be used for.
>
> -- Damien
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


  reply	other threads:[~2004-12-03  7:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-30 20:30 Ritesh Kumar
2004-12-01 23:17 ` [Caml-list] " Damien Doligez
2004-12-03  7:24   ` Ritesh Kumar [this message]
2004-12-03  8:22     ` Ville-Pertti Keinonen
2004-12-04 11:05       ` Missing a function Frédéric Gava
2004-12-04 13:25         ` [Caml-list] " sejourne_kevin
2004-12-04 14:13           ` Frédéric Gava
2005-01-29 19:34             ` Radu Grigore
2005-01-29 19:55               ` Radu Grigore
2005-01-29 21:05               ` Olivier Andrieu
2005-02-04 20:18               ` Radu Grigore

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=6FBBD2B0-44FC-11D9-AF66-000A95CDFBE4@cs.unc.edu \
    --to=ritesh@cs.unc.edu \
    --cc=caml-list@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).