caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: bluestorm <bluestorm.dylc@gmail.com>
To: David Allsopp <dra-news@metastack.com>
Cc: Florent Ouchet <florent.ouchet@imag.fr>, caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] OCaml 3.12.0+beta1
Date: Fri, 25 Jun 2010 11:35:29 +0200	[thread overview]
Message-ID: <AANLkTikkEec4xJI4b2d5qVmMzP_iK8AY44SV8XmiT8HB@mail.gmail.com> (raw)
In-Reply-To: <E51C5B015DBD1348A1D85763337FB6D9065B96@Remus.metastack.local>

[-- Attachment #1: Type: text/plain, Size: 3141 bytes --]

On Fri, Jun 25, 2010 at 10:48 AM, David Allsopp <dra-news@metastack.com>wrote:

>
> If *your* code has to be *backwards*-compatible with the OCaml 3.11.x
> compiler then you shouldn't be using that shorthand at all. [..] Any
> features in 3.12 shouldn't be being used at all *if* 3.11 compatibility is
> your goal.


The problem is that camlp4 doesn't distinguish at present between "a; " and
"a = a;" as label patterns : the former is desugared into the latter while
parsing. With the current implementation, both will be pretty-printed as "a
= a;". It may happen however than the implementation change and both be
printed as "a;". In that case, my implementation would break. That's what I
meant.

In the best of all worlds (user-wise), Camlp4 would track that information
and always output "a;" when there was "a;", and "a = a;" otherwise. I'm not
sure it's worth complicating the Camlp4 AST again for such a feature.

It is possible to work-around this issue by using a slightly more subtle
pattern : my filter could for example translate "a = a" in "a = (_ as a)",
wich is equivalent and surely wouldn't be resugared.



> I'm sure we all agree that any well-written piece of code should never emit
> compiler warnings


I don't agree. Warnings are there for things that could be errors, but are
not necessarily one. In some case you'll want to break the rules. You may
use build options to disable the specific warning in the specific file, but
that's not necessarily a good idea. I'm happy with some warning remaining if
they're justified.

This discussion is reminiscent of on the warn-error problem we were recently
warned (!) about by Damien (do not use warn-error for released code !) :
http://caml.inria.fr/pub/ml-archives/caml-list/2009/11/91883440c8a0481a4233758946e5c3bf.fr.html



> As an aside, while it seems fair enough that a pre-processor such as camlp4
> may mess up *comments* it seems to me a bug that it messes up ocamldoc
> *instructions* (which are reasonably viewable as a functional part of your
> code). But is that a well-rehearsed argument about a really unfixable
> problem?
>

In that case, it isn't really a problem. There could be an issue if an user
want to build documentation for a 3.12 code translated into a 3.11 code by a
camlp4 filter. Why not simply use ocamldoc-3.12 to generate the
documentation instead ?


For the generate case, well, it is a problem. OCaml doc instructions are
comments (if we're both talking about the (** .. *) thing), and comments and
whitespace are not handled well by syntaxic AST for language where they
don't matters.
Ocamldoc use a comment position hack to associate comments to the caml AST,
and while it's probably a necessary hack, I'm not sure it's fair to blame
camlp4 for breaking it.


If you really want language-integrated documentation, the Right Thing To Do
is to keep places for documentation/annotations directly in the language
syntax (and AST). This is what Python has done with the "docstring" wich has
a dedicated place in declarations.
There is no such thing in Ocaml syntax, so we have to use workarounds that
work reasonably well, but not always.

[-- Attachment #2: Type: text/html, Size: 4355 bytes --]

  reply	other threads:[~2010-06-25  9:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-16 13:07 Damien Doligez
2010-06-16 16:28 ` [Caml-list] " Yoann Padioleau
2010-06-16 18:40   ` Martin Jambon
2010-06-16 20:52 ` Török Edwin
2010-06-17 13:35   ` xclerc
2010-06-18 14:56     ` xclerc
2010-06-19  5:51 ` Stéphane Glondu
2010-06-24  9:38 ` Florent Ouchet
2010-06-24 17:45   ` Martin Jambon
2010-06-24 18:59     ` Florent.Ouchet
2010-06-24 19:29       ` Dmitry Bely
2010-06-24 19:31       ` Mathias Kende
2010-06-24 19:39       ` Till Varoquaux
2010-06-24 20:49         ` Florent Ouchet
2010-06-24 20:57           ` Hezekiah M. Carty
2010-06-24 22:05             ` Florent Ouchet
2010-06-25  5:54               ` bluestorm
2010-06-25  6:24                 ` Florent Ouchet
2010-06-25  8:17                   ` bluestorm
2010-06-25  8:48                     ` David Allsopp
2010-06-25  9:35                       ` bluestorm [this message]
2010-06-25  7:29 ` bluestorm

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=AANLkTikkEec4xJI4b2d5qVmMzP_iK8AY44SV8XmiT8HB@mail.gmail.com \
    --to=bluestorm.dylc@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=dra-news@metastack.com \
    --cc=florent.ouchet@imag.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).