caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Ryan Tarpine" <rtarpine@hotmail.com>
To: ctchou@mipos2.intel.com, caml-list@inria.fr
Subject: Re: [Caml-list] Weird typing problem
Date: Tue, 21 May 2002 20:14:21 -0400	[thread overview]
Message-ID: <F218jp3b6uIU1Gj03oH000021c7@hotmail.com> (raw)

>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)
>
>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
>-------------------

See http://caml.inria.fr/FAQ/FAQ_EXPERT-eng.html#polymorphisme.  In short, 
(quoted from the FAQ)

When type-checking
  let name = expr1 ...
The type of expr1 is generalized when expr1 is a function, an dentifier or a 
constant. Otherwise the identifier name is not polymorphic (type variables 
are not generalized).
...
The new rule implies that if expr1 is a function application, then the 
identifier name is monomorphic

This is done because "a secure type system for Caml must forbid the 
existence of polymorphic mutable values at run-time" and this was basically 
the easiest way to do it.  Read the FAQ for an example.

HTH,

Ryan Tarpine, rtarpine@hotmail.com
"To err is human, to compute divine.  Trust your computer but not its 
programmer."
  - Morris Kingston


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

-------------------
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-22  0:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-22  0:14 Ryan Tarpine [this message]
     [not found] <F143h1mIs1Dk3fqSUVd000021b5@hotmail.com>
2002-05-21 23:58 ` Ching-Tsun Chou
  -- 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=F218jp3b6uIU1Gj03oH000021c7@hotmail.com \
    --to=rtarpine@hotmail.com \
    --cc=caml-list@inria.fr \
    --cc=ctchou@mipos2.intel.com \
    /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).