Version française
Home     About     Download     Resources     Contact us    
Browse thread
Weak types ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre CASTERAN <Pierre.Casteran@l...>
Subject: Weak types ?


 Hello, all.

 I suppose the following problem concerns "weak" types, but i don't see
 the reason (I have no assignment at all in this definitions !)

let toto =
  let id x = x
  in id id;;
(*
 val toto : '_a -> '_a = <fun>
             ^      ^

             why not " 'a " ?  
             
*)

toto 5;;
(* ok *)

toto (fun z -> z);;

(*
This expression has type 'a -> 'a but is here used with type int
*)

If i  remember Xavier's works, the "weak" types were necessary for
dealing with references, continuations/exceptions, and i/o streams,....

What's the problem with these gentle purely functional top-level 
definitions  ?



Pre Scriptum :

 I (still )  work with Objective Caml version 1.03

-- 
Pierre Casteran,

LaBRI, Universite Bordeaux-I      |    12 place Puy Paulin
351 Cours de la Liberation        |    33000 Bordeaux
F-33405 TALENCE Cedex             |    France
France                            |    (+ 33) 5 56 81 15 80
tel : (+ 33) 5 56 84 69 31
fax : (+ 33) 5 56 84 66 69
email: Pierre . Casteran @ labri . u-bordeaux . fr  (but whithout white space)
www: http://dept-info.labri.u-bordeaux.fr/~casteran

"Combien de petites violences la verité et l'analyse  subissent-elles 
quotidiennement dans le silence de nos pensées engourdies ?"

[Serge Halimi, in "Les nouveaux chiens de garde" (Liber, ed.)]