caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nathaniel J. Gaylinn" <ngaylinn@cs.brown.edu>
To: caml-list@yquem.inria.fr
Subject: OCaml IDE (Camlp4 for code formatting)
Date: Mon, 20 Jun 2005 16:08:08 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.58.0506201607470.2193@point> (raw)


One feature I want my program to have is autoformatting, that is, the
ability to go through and indent source code for you in some standard way.
At first glance, OCamlp4 seemed like the way to go for this, but under
further inspection I'm not sure this is true.

My main problem with OCamlp4 is that it changes the input source code!
Expressions like "5;;" that are just used for side effect are replaced
with "let _ = 5;;" which is equivalent, but different code. I understand
why it makes this change, but since my program is intended for students
the last thing I want is for it to change their code, even in a trivial
way such as this. Also, I'm pretty sure I've observed OCamlp4 eating
comments, which obviously is no good.

Is there a nice way to get OCamlp4 not to change the source code it's
given in any way except for spacing? Is there some other convenient way to
autoformat OCaml source? Is there a documented standard of what properly
formatted OCaml code should look like? It's hard to derive a set of
indentation rules just from anecdotal code snippets.

On a similar note, is there any reference to the format in which Camlp4
outputs its syntax tree? I might be able to use the syntax tree for
formatting and other purposes in my ide, but I can't at all read the
binary format it spits out. Is this something easy to read, or is it only
meant to be accessed by OCaml itself?

Thanks,

  -- Nate Gaylinn


             reply	other threads:[~2005-06-20 20:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-20 20:08 Nathaniel J. Gaylinn [this message]
2005-06-21 10:33 ` [Caml-list] " Hendrik Tews
2005-06-21 13:47   ` Nathaniel J. Gaylinn
2005-06-21 15:18     ` Hendrik Tews
2005-06-21 18:11       ` David Brown
2005-06-29 14:54         ` [Caml-list] Keyboard interrupt in Windows Nathaniel J. Gaylinn
2005-06-29 16:13           ` Christopher A. Watford

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=Pine.LNX.4.58.0506201607470.2193@point \
    --to=ngaylinn@cs.brown.edu \
    --cc=caml-list@yquem.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;
as well as URLs for NNTP newsgroup(s).