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-21 (23:58)
From: Ching-Tsun Chou <ctchou@m...>
Subject: Re: [Caml-list] Weird typing problem

   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

- 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