Version française
Home     About     Download     Resources     Contact us    
Browse thread
Print values like the toplevel's printer
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: pad@r...
Subject: Re: [Caml-list] [Too hard?] Print values like the toplevel's printerI
"Wolfgang Müller" <Wolfgang.Mueller2@uni-bayreuth.de> writes:

> > why don't you like this solution ? is it because it is slow ? ugly ?
> 
> I think your solution gives me the feeling that there must be something
> simpler than that.

:) 

> 
> This is not criticizing you, it is rather a question to the Caml people,
> like e.g. X. Leroy and colleagues and/or the ExtLibs:
> 
> (Why?) is there no really simple way getting the print functionality of
> the standard toplevel?

Here is my 50 cent:

First because the type of this function will be wierd, 
 print: 'a -> string 
 (of course there are other wierd stuff in Ocaml such as the type of printf, or the type of exn)

Haskell have solved this problem by introducing overloading (and the deriving Show)

Secondly it would requires to add type information in the code.
The toplevel have to maintain more information than the native code program
(which leads to less efficiency).
One of the advance of ML over Lisp is that it is strongly typed which allows to have
code that dont have anymore type information and typecheck. All is done at compile-time.


> 
> Cheers,
> Wolfgang
> 
> 
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs