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 MAA20604; Sun, 13 Oct 2002 12:20:46 +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 MAA20529 for ; Sun, 13 Oct 2002 12:20:45 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g9DAKe520938; Sun, 13 Oct 2002 12:20:40 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA20706; Sun, 13 Oct 2002 12:20:40 +0200 (MET DST) Date: Sun, 13 Oct 2002 12:20:40 +0200 From: Xavier Leroy To: Yang Shouxun Cc: caml-list@inria.fr Subject: Re: [Caml-list] automatic extraction of mli file? Message-ID: <20021013122040.A20071@pauillac.inria.fr> References: <3DA8021B.3050102@fltrp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <3DA8021B.3050102@fltrp.com>; from yangsx@fltrp.com on Sat, Oct 12, 2002 at 07:06:03PM +0800 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > I'm quite new in OCaml and I want to know what is the practice of the > OCaml programmers. Will you first write the interface files, then > implement, or vice versa? Here is my recipe: you write an interface file when the interface of your module becomes clearly defined, and you feel ready to document the interface. For some modules, typically data structures, this means the interface is written first: you know that you'll need, say, doubly-linked circular lists, and you have a fairly clear idea of what operations you'll need. Then, you can write the interface and some comments on the behavior of the functions, and go ahead with writing the remainder of the program. Later, you'll implement the data structure. For other modules, you'd typically start with the implementation and no interface file, as the external interface to your module isn't clear yet. When it stabilizes and needs to be documented, now is the time to write an interface file. Think of it this way: the interface file is where you document (via comments) the external, behavioral specification of your code. Comments in implementation file should just be comments on how the implementation works (e.g. "this is Kildall's worklist algorithm, as documented in section 11.4.2"). If you ever feel like writing a behavioral comment in an implementation file ("this function computes this and that"), don't: create the interface file instead. - Xavier Leroy ------------------- 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