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
[Caml-list] Does this function exist?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-09-17 (17:18)
From: Florian Hars <florian@h...>
Subject: Re: [Caml-list] Does this function exist?
Kontra, Gergely wrote:
> BTW allowing polimorphism doesn't solve the problem? 


 > Ocaml is strictly
> typed, so one can figure out it's parameter in compile-type, right?

Yes. This is why such a beast as requested at the start of this thread can't be
implemented as a function, but only with some serious compiler magic (that 
breaks separate compilation) like the toplevel does.

How would you compile a module like:

type verbose_list 'a = Nil | Cons of 'a * 'a verbose_list
let cons elt l =
	print_string "Consing element ";
	print elt;
	print_string " to list ";
	print l;
	print_newline ();
	Cons (elt, l)

when all you know about elt at compile time is that it is completly polymorphic?

Yours, Florian Hars.

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