[wg-camlp4] A new branch to experiment with extension points

Alain Frisch alain.frisch at lexifi.com
Wed Mar 6 13:18:12 GMT 2013

On 03/06/2013 01:57 PM, Leo White wrote:
> I'm not sure that I understand the need for general attributes not
> attached to anything in the middle of the module. If their position is
> important then there must be some item that they are essentially
> attached to, if their position is not important then they can just be
> placed at the top of the module.

I was mentioning ocamldoc section headers.  Without "floating" 
attributes, one can write:

[^^doc section "....."] include sig

On the one hand, this is nice, because it materializes the scope of the 
section (and you can benefit from your editor's folding feature).  But 
on the other hand, it is quite verbose and forces some extra 
indentation.  More fundamentally, this might not interact nicely with 
other features/tools, which might require a different nesting structure. 
  For instance, imagine a global dead code detector, for which one might 
want to exclude whole "sections" of exported declarations.  One could 
use the same technique as for ocamldoc sections:

[^^dead_code_detector ignore] include sig

But then we need to close/reopen those sections so that they remain 
nested within ocamldoc ones.  With floating attributes, one can write:

[*doc section "Section 1"]

[*dead_code_detector ignore true]


[*doc section "Section 2"]


[*dead_code_detector ignore false]


Does it make sense?


More information about the wg-camlp4 mailing list