Browse thread
Re: [Caml-list] Weird typing problem
- Ryan Tarpine
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| 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 >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