Version française
Home     About     Download     Resources     Contact us    
Browse thread
OSR: META files for packages containing syntax extensions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dario Teixeira <darioteixeira@y...>
Subject: Re: [Caml-list] OSR: META files for packages containing syntax extensions
Hi,

> Some extensions use eg. both a parser and a filter; i guess they'd
> need to chose the most meaningful prefix (are they primarily intended
> to modify the existing syntax, or change a behavior ?).
> There are some code that can be described as a "syntax extension", but
> that does not use any of the camlp4 parser/printer/filter tools. The
> 'extensions' using the library type-conv (
> http://www.ocaml.info/home/ocaml_sources.html#type-conv ), for
> example, use a specific registration mechanism. I guess the p_ prefix
> would be appropriate for those corner cases.

Thanks for ellucidation.  Alternatively, since the preprocessor is
oblivious to the name of the package (as you say, even Camlp5 may
only care about the name of the .cmo file), we can simply declare
this to be a documentation problem and to not enforce any convention
regarding the package name (except for the previously discussed .syntax
suffix).

Therefore, the package implementing the "openin" extension could be
called "pa_openin", "openin", or whatever the author prefers due to
historical reasons.  The only requirement is that the syntax extension
itself should reside in an "openin.syntax" subpackage.


> Another common case is when the syntax extension rely on a
> preprocessor-time module or library (eg. type-conv). It could be
> helpful to add a description of that possibility.

I think that is also a documentation issue.  Ideally, the META files
should be constructed in such a way that the user should not have to
care about extension dependencies.  As an example, consider the Sexplib
syntax extension, which itself depends on the type-conv extension.
On my system, I have patched the META files so that this is transparent
to the Sexplib users.

Here's my META file for Sexplib:

--------------------------------------------------------
name="sexplib"
version="3.0.0"
description="Sexplib - automated S-expression conversions"
requires="bigarray"
archive(byte)="sexplib.cma"
archive(native)="sexplib.cmxa"

package "syntax" (
  requires = "sexplib,type-conv.syntax,camlp4"
  version = "3.0.0"
  description = "Syntax extension for Sexplib"
  archive(syntax,preprocessor) = "pa_sexp_conv.cmo"
  archive(syntax,toploop) = "pa_sexp_conv.cmo"
  )
--------------------------------------------------------

And the META file for Type-conv:

--------------------------------------------------------
name="type-conv"
version="1.0.0"
description="Type-conv - support library for preprocessor type conversions"

package "syntax" (
  requires = "camlp4"
  version = "1.0.0"
  description = "Syntax extension for type-conv"
  archive(syntax,preprocessor) = "pa_type_conv.cmo"
  archive(syntax,toploop) = "pa_type_conv.cmo"
  )
--------------------------------------------------------


> Is there a way to specify a dependency on a specific preprocessor
> (between camlp4o and camlp4r, for example ?). Most extension actually
> won't work with both syntaxes (classical and revised), and it could be
> helpful to make it apparent in the package description (although most
> of the time an horrible preprocessor-runtime error will happen).
> More generally, i'm concerned with the possible incompatibilities
> between syntax extensions (however, this may be a bit off-topic).

I don't know if there's support for those cases (are there any in the wild?).
Perhaps some of Findlib's gurus can enlighten us...

Cheers,
Dario



      ___________________________________________________________ 
Rise to the challenge for Sport Relief with Yahoo! For Good  

http://uk.promotions.yahoo.com/forgood/