Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] Dequeues (was Generation of streams is slow)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <Pierre.Weis@i...>
Subject: Re: [Caml-list] indent 2
> Hi All,
> 
> Is the indentation with the step 2 a _must_ for those who program in
> OCaml? I got used 4, and already set all the necessary variables for
> caml-mode, so that I get:
> 
> let count_range bt lwb upb =
>     let bti = (IVB.from_to bt lwb upb) in
>     let rec count1 bti n =
> 	if IVB.ok bti then begin
> 	    match IVB.next bti with
> 		Some (k, v, b) ->
> 		    (printf "in count1 %d %d %b\n" k v b); flush stdout;
> 		    let n' = if b then n + 1 else n in
> 		    count1 bti n'
> 	      |	None -> raise (Failure "this cannot happen")
> 	end
> 	else
> 	    n
>     in
>     count1 bti 0
> 
> Is this horrible/terrible/tolerable/appropriate?
> 
> Alexander
> -------------------
> Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
> To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr

Instead of answering by a two lines long comment and my version of
the best version of your program, I prefer to redirect you to a more
appropriate and documented source concerning Caml programming styles.

This is a good occasion for me to announce a major rewritting of the
Caml programming guide lines where this question is discussed in the
large among a lot of others concerning style, including where to break
lines in Caml programs, where and why use (or avoid) parens, etc.

          http://pauillac.inria.fr/caml/FAQ/pgl-eng.html
          http://pauillac.inria.fr/caml/FAQ/pgl-fra.html

Each programming problem is normally carefully discussed with
arguments (and counter-arguments, and sometimes
counter-counter-arguments) gathered from observation of a lot of Caml
programs including the Caml compilers source code, and from statements
and advices from some of the best Caml programmers in the world, not
mentionning one of the best source of counter-counter-meta-arguments I
know about Caml programs indentation and syntax problems: the sudden
and not always so kind flamewares that appear, while quietly sitting
for lunch in the INRIA's cafeteria !

However, if there is something new to add to these guidelines, feel
free to drop me a not: I would be glad to translate it in french or
english or even incorporate it as is, if you provide a
translation. Don't hesitate to signal an error either, since this is
the worse situation to face for a guideline writter to incorporate a
bug in the suggested programming style!

Thanks in advance for your help,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr