Version française
Home     About     Download     Resources     Contact us    
Browse thread
Teaching bottomline, part 3: what should improve.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: tab@s...
Subject: Re: [Caml-list] Teaching bottomline, part 3: what should improve.
On Wed, May 23, 2007 at 08:49:57AM -0400, Brian Hurt wrote:
> Hundreds of lines?  I've seen ten's of lines, but never hundreds.

It's happening sometimes, and it's a major pain. It usually because you
got the wrong type returned, and you got lots of passthrough functions.
when it gets into the function that actually do something with the data,
ocaml see a mismatch obviously... in this case you want to correct the
source function, not where the error happened ...

> Of course, I generally type annotate at the level of functions at least 
> (using .mli files is to be encouraged, IMO).  So type errors generally 
> don't escape functions.  And I keep functions reasonably short- tens of 
> lines long at most...

this is certainly a very good thing to do, but some people doesn't do
this unfortunately :(

For .mli file, it's not always an advantage to have them; having 2
files to edit each time you make a modification is quite annoying..
I wish there was an inline signature ala Haskell for OCaml, something
along the line of:

=== string.ml ====
val length : string -> int
....

let length s = ...
....
==================

Cheers,
-- 
Vincent Hanquez