Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] ocaml and large development projects
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: brogoff@s...
Subject: Re: [Caml-list] Reading a file
On Wed, 21 May 2003, Eray Ozkural wrote:
> Err. Yes, but anybody who's used Haskell will know that those annotations can 
> be handy when you're writing the code. They are harmless too, why don't we 
> have such a syntax?

It's more than that. In Haskell 98, using polymorphic recursion requires 
that you explicitly annotate the recursive function. Some other languages 
like Clean and Mercury use type inference. OCaml requires that you explicitly 
annotate the functions to get polymorphic recursion, whether you use explicit 
polymorphism of record fields, polymorphic methods, or the experimental 
recursive module feature. My current opinion is that explicit annotation is 
the right way. 

WRT your main point, I agree that having a separate signature close to the 
function is often more readable. In OCaml, the syntax is 

  let function_name : function_type = 
    fun arg0 arg1 ... argN -> 

and while I admit that I prefer the Haskell/Clean separate signatures, this 
is often good enough. I'd file this one under "petty complaint" for now. 
There are bigger fish to fry. 

-- Brian


-------------------
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