From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA22099; Wed, 21 May 2003 11:16:13 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA22073 for ; Wed, 21 May 2003 11:16:09 +0200 (MET DST) Received: from fichte.ai.univie.ac.at (fichte.ai.univie.ac.at [131.130.174.156]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h4L9G8H23648 for ; Wed, 21 May 2003 11:16:08 +0200 (MET DST) Received: from fichte.ai.univie.ac.at (markus@localhost.ai.univie.ac.at [127.0.0.1]) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.3) with ESMTP id h4L9G8wf010153; Wed, 21 May 2003 11:16:08 +0200 Received: (from markus@localhost) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.3) id h4L9G8GO010152; Wed, 21 May 2003 11:16:08 +0200 Date: Wed, 21 May 2003 11:16:08 +0200 From: Markus Mottl To: Siegfried Gonzi Cc: caml-list@inria.fr Subject: Re: [Caml-list] Reading a file Message-ID: <20030521091608.GB9455@fichte.ai.univie.ac.at> Mail-Followup-To: Siegfried Gonzi , caml-list@inria.fr References: <4.3.2.7.2.20030517225010.04b748a0@localhost> <4.3.2.7.2.20030519120753.04545700@localhost> <200305201007.17990.wolfgang.mueller2@uni-bayreuth.de> <3EC9EA84.3070404@stud.uni-graz.at> <20030520132032.GA9564@roke.freak> <3ECB189C.5090400@stud.uni-graz.at> <3ECB212F.2080704@stud.uni-graz.at> <3ECB2261.2030404@stud.uni-graz.at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3ECB2261.2030404@stud.uni-graz.at> User-Agent: Mutt/1.4.1i X-Spam: no; 0.00; caml-list:01 siegfried:01 gonzi:01 mittwoch:01 21.:99 annotates:01 annotations:01 char:01 rebel:99 abstraction:01 compiler:01 ocaml:01 schrieb:01 mottl:02 enforce:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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