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
how to upset the ocaml type system....
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-08-29 (00:56)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] how to upset the ocaml type system....

On Tue, Aug 28, 2007 at 11:18:50PM +1000, Pietro Abate wrote:

> the other day I was looking for a fringe case to show me the worst
> complexity of the type inference algorithm...

Interesting. To see the resulting time, I changed the code into:

  let f =
  let x1 = fun x -> (x,x) in
  let x2 = fun y -> x1 ( x1 y ) in
  let x3 = fun y -> x2 ( x2 y ) in
  let x4 = fun y -> x3 ( x3 y ) in
  let x5 = fun y -> x4 ( x4 y ) in
  x5 ( fun z -> z ) ;;

(I stopped at x5 to have a correct answering time.)

Compiling with -i to display the resulting type:
   ocamlc -c -i t.ml

Oops... lines and lines and lines...
Mmm.... let's see:
   ocamlc -c -i t.ml | wc -l

Daniel de Rauglaudre