Browse thread
[Caml-list] ocaml and large development projects
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| 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. Regards, Markus Mottl -- Markus Mottl http://www.oefai.at/~markus markus@oefai.at ------------------- 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