caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ching-Tsun Chou <ctchou@mipos2.intel.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Weird typing problem
Date: Tue, 21 May 2002 16:58:32 -0700 (PDT)	[thread overview]
Message-ID: <200205212358.g4LNwWX27670@zws707.sc.intel.com> (raw)
In-Reply-To: <F143h1mIs1Dk3fqSUVd000021b5@hotmail.com> (rtarpine@hotmail.com)


   Being only a beginner, I think it's because in the interpreter the type of 
   the function doesn't need to be "finalized" completely, while in the 
   compiler must *absolutely* have the exact type so it can generate code.  In 
   the interpreter, it's fine for the type to be "refined" later on, because it 
   won't be accessed by any outside applications.

   The compiler can't generate code for functions with arguments of type '_a 
   because that would require the object code to be modified when the function 
   is called for the first time.  The code would need to be changed depending 
   on which program called it, since (list_last [2;3]) and (list_last 
   [2.0;3.0]) would have different effects (the first one would make the type 
   of list_last be ints to ints while the second floats to floats).

Why can't the compiler just substitute 'a for '_a if '_a can't be
resolved?  What's wrong with that?  Surely O'Caml can handle
polymorphism.

- Ching Tsun
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


       reply	other threads:[~2002-05-21 23:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <F143h1mIs1Dk3fqSUVd000021b5@hotmail.com>
2002-05-21 23:58 ` Ching-Tsun Chou [this message]
2002-05-22  0:14 Ryan Tarpine
  -- strict thread matches above, loose matches on Subject: below --
2002-05-21 23:48 Ryan Tarpine
2002-05-21 22:13 Ching-Tsun Chou
2002-05-21 23:03 ` Pixel
2002-05-21 23:20   ` Ching-Tsun Chou

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=200205212358.g4LNwWX27670@zws707.sc.intel.com \
    --to=ctchou@mipos2.intel.com \
    --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).