English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Re: [Caml-list] Weird typing problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-05-22 (00:14)
From: Ryan Tarpine <rtarpine@h...>
Subject: Re: [Caml-list] Weird typing problem
>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
>- 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.


Ryan Tarpine, rtarpine@hotmail.com
"To err is human, to compute divine.  Trust your computer but not its 
  - 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