Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Alain Frisch <alain@frisch.fr>
To: Peter Zotov <whitequark@whitequark.org>
Cc: caml-list <caml-list@inria.fr>, wg-camlp4@lists.ocaml.org
Subject: Re: [Caml-list] [ANN] ppx_protobuf
Date: Tue, 06 May 2014 09:33:43 +0200	[thread overview]
Message-ID: <53689057.5010802@frisch.fr> (raw)
In-Reply-To: <5c5c8af234151e7fdc529a63ce305dab@whitequark.org>

On 05/06/2014 06:59 AM, Peter Zotov wrote:
> While this behavior can be fixed for the most common misplacements, I
> feel like
> it's a drawback intrinsic to the extension points mechanism: misplaced
> or misnamed
> attributes are going to be silently ignored.

Indeed.

> Do you have any ideas for a solution? I have toyed with an idea of
> a "verifier extension" which would ascertain the lack of attributes after
> all the rewriter passes have presumably removed the attributes known
> to them, but it wouldn't work  with generic attributes like [@default] that
> must be shared between extensions.

I'm not convinced by the idea of checking the absence of attributes 
after -ppx rewriters are applied.  You mention one reason (generic 
attributes, which shouldn't be discarded by any specific -ppx), but 
there are others:

  - Even non-generic attributes might be better left in the Parsetree 
sent to OCaml, so that they appear in particular in the dumped typedtree 
(.cmt/.cmti), which could be useful for further processing (e.g. a 
version of ocamldoc based on .cmti files).

  - Attributes are not only designed to support -ppx rewriters.  They 
can also be used by tools which inspect compiled .cmt/.cmti/.cmi files, 
or stand-alone tools which work on source files but are not used as 
preprocessors.

  - There is also the case of "optional" -ppx rewriters (e.g. a code 
instrumentation tool which could be applied or not).


An "attribute checker" (either integrated in a generic style-checking 
tool such as Mascot or as a stand-alone tool,  or maybe even as an 
"identity" -ppx so that it is always included in the compilation chain) 
would need some way to know which attributes are allowed and in which 
context (it's fair to let each tool check the advanced conditions on the 
payload and constraints such as nesting conditions).  For instance, each 
tool could come with a small text file describing the attributes it 
recognizes (and in which contexts), maybe also with a rough description 
of admissible payloads and -- why not -- some succinct documentation 
about the attribute.  This information could be useful not only for the 
attribute checker, but potentially by other tools as well (e.g. an IDE).


-- Alain

  reply	other threads:[~2014-05-06  7:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-02 14:29 Peter Zotov
2014-05-03 16:08 ` Malcolm Matalka
2014-05-03 16:24   ` Peter Zotov
2014-05-03 18:46     ` Malcolm Matalka
2014-05-03 18:52       ` Peter Zotov
2014-05-04  4:49         ` Malcolm Matalka
2014-05-04  8:55           ` Peter Zotov
2014-05-04 15:18             ` Malcolm Matalka
2014-05-04 22:21               ` Peter Zotov
2014-05-04 22:38                 ` Daniel Bünzli
2014-05-04 20:34             ` Gerd Stolpmann
2014-05-06  4:29 ` Alain Frisch
2014-05-06  4:59   ` Peter Zotov
2014-05-06  7:33     ` Alain Frisch [this message]
2014-05-06 10:42   ` Malcolm Matalka

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=53689057.5010802@frisch.fr \
    --to=alain@frisch.fr \
    --cc=caml-list@inria.fr \
    --cc=wg-camlp4@lists.ocaml.org \
    --cc=whitequark@whitequark.org \
    /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