Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Markus Mottl <markus@mail4.ai.univie.ac.at>
To: Pierre Weis <Pierre.Weis@inria.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] indent 2
Date: Sun, 22 Jul 2001 13:20:10 +0200	[thread overview]
Message-ID: <20010722132010.A24487@fichte.ai.univie.ac.at> (raw)
In-Reply-To: <200107221006.MAA17045@pauillac.inria.fr>; from Pierre.Weis@inria.fr on Sun, Jul 22, 2001 at 12:06:05 +0200

On Sun, 22 Jul 2001, Pierre Weis wrote:
> Personnaly, I use one space with some exceptions for 2 spaces
> indentation (which is inconsistent, I know it!) for reasons that are
> explained in the Caml programming guidelines. (In short, I write
> 2 spaces to align the |'s in the pattern matchings of function
> definitions:

Always eager to improve the syntactic beauty of my sources, I wondered
how this indentation style looks like so I peeked at the implementation
of the Format-module, which seems to be written by you.

Indeed, this style is obviously very coherent: one can find anything
from 1, 2 to 4 spaces of indentation consistently applied throughout
the whole file, e.g.:

  let add_queue x q =
   let c = Cons {head = x; tail = Nil} in
   ...

  let pp_print_as state n s =
    if state.pp_curr_depth < state.pp_max_boxes
    ...

  let pp_print_newline state () =
      pp_flush_queue state true; state.pp_flush_function ()
      ...

The rules can be easily inferred: one space if the function body starts
with a "let", two if it starts with "if" and four in any other case.

Is it this kind of consistency you mean in the Programming Guidelines? :-)

Best regards,
Markus Mottl

  P.S.: Sorry for my sarcasm! As usual I couldn't resist... ;)

-- 
Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus
-------------------
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


  reply	other threads:[~2001-07-22 11:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-21 11:29 Damien Doligez
2001-07-21 16:45 ` Alexander V. Voinov
2001-07-21 18:07   ` Brian Rogoff
2001-07-22 10:06     ` Pierre Weis
2001-07-22 11:20       ` Markus Mottl [this message]
2001-07-23  0:27       ` Brian Rogoff
2001-07-23  7:52         ` Luc Maranget
2001-07-23 10:20         ` Markus Mottl
2001-07-22 19:40     ` Jeremy Fincher
  -- strict thread matches above, loose matches on Subject: below --
2001-07-21  4:50 [Caml-list] Dequeues (was Generation of streams is slow) Brian Rogoff
2001-07-21  5:03 ` [Caml-list] indent 2 Alexander V. Voinov
2001-07-21 11:09   ` Pierre Weis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010722132010.A24487@fichte.ai.univie.ac.at \
    --to=markus@mail4.ai.univie.ac.at \
    --cc=Pierre.Weis@inria.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox