Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2003-05-21 (09:16)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] Reading a file
Siegfried Gonzi schrieb am Mittwoch, den 21. Mai 2003:
> This is one of the reasons why I do not get it that nobody annotates 
> types in OCaml. If I had  to deal with a Clean function I would not have 
> made the mistake of using split in a wrong manner, because:

But you can use type annotations in OCaml - it's optional! I suppose
that Clean, too, doesn't enforce explicit types for all functions,
but I am not sure.

> split:: String Char -> [String]
> split s c ....
> but in OCaml:
> split s c ...

You mean:

  let split s c = ...

But you can also write:

  let split (s : string) (c : char) : string list = ...

> I agree the compiler would rebel if I pass wrong types, however, this 
> does not increase readability as opposed to Clean.

It's really just a matter of practice: I never use type annotations,
because my functions usually have parameter names that speak for
themselves. Only library functions get an explicit interface, both for
abstraction and documentation - in a separate file.

Markus Mottl

Markus Mottl

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: